#
f86cdd7d
|
| 12-Aug-2025 |
Ed Tanous <etanous@nvidia.com> |
Move common structures
It's ideal if the various BMCWEB_ROUTE lib calls do not call from one another. This reduces the amount of code that's compiled each time separately.
Tested: Code compiles.
Move common structures
It's ideal if the various BMCWEB_ROUTE lib calls do not call from one another. This reduces the amount of code that's compiled each time separately.
Tested: Code compiles.
Change-Id: I4822ce66c122f261cc6aa34bbd99371b7eff48c8 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
3577e446
|
| 19-Aug-2025 |
Ed Tanous <ed@tanous.net> |
Fix includes
Our includes haven't been enforced by tidy in a while. Run the script, check in the result, minus the false positives.
Change-Id: I6a6da26f5ba5082d9b4aa17cdc9f55ebd8cd41a6 Signed-off-
Fix includes
Our includes haven't been enforced by tidy in a while. Run the script, check in the result, minus the false positives.
Change-Id: I6a6da26f5ba5082d9b4aa17cdc9f55ebd8cd41a6 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
99ff0ddc
|
| 22-Apr-2025 |
Myung Bae <myungbae@us.ibm.com> |
Fix race condition between subscription deletions
After the connection max-retry with the policy of "TerminateAfterRetries", coredump may have been occurred although it seems rare.
Stack frame of O
Fix race condition between subscription deletions
After the connection max-retry with the policy of "TerminateAfterRetries", coredump may have been occurred although it seems rare.
Stack frame of One occurrency indicates that an invalid memory access happened inside deleteSubscription().
1) http_client is waiting for async_read() to handle sendEventToSubscriber().
``` - recvMessage via async_read() [hold Connection with shared_from_this()] --> call afterRead(). - afterRead() find the invalid response (i.e. probably disconnected from the other end?), and call waitAndRetry() - waitAndRetry() detects the maxRetryAttempts (with the policy of "TerminateAfterRetries"), and invokes callback callback is ConnectionPool::afterSendData(). ```
2) Meanwhile, the subscription is explicitly requested to delete via Redfish API.
``` BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/<str>/") ... .methods(boost::beast::http::verb::delete_)( ... if (!event.deleteSubscription(param)) ```
3) Later on, http_client invokes resHandler() but this resHandler() is bound with its own subscription object like this.
``` bool Subscription::sendEventToSubscriber(std::string&& msg) { client->sendDataWithCallback( std::move(msg), userSub->destinationUrl, static_cast<ensuressl::VerifyCertificate>( userSub->verifyCertificate), httpHeadersCopy, boost::beast::http::verb::post, std::bind_front(&Subscription::resHandler, this)); <== ```
As the result, if the subscription object is already deleted outside (i.e. Redfish API delete), resHandler() which is from async_read callback may be accessing the invalid object.
``` void Subscription::resHandler(const crow::Response& res) { ... if (client->isTerminated()) { hbTimer.cancel(); if (deleter) { deleter(); --> This invokes deleteSubscription() } } } ```
Quick summary of stack frame:
``` 0 __GI_memcmp (s1=<optimized out>, s2=<optimized out>, len=<optimized out>) at memcmp.c:342
warning: 342 memcmp.c: No such file or directory at memcmp.c:342 at /usr/include/c++/13.2.0/bits/basic_string.h:3177 ... this=0x814fa8 <redfish::EventServiceManager::getInstance(boost::asio::io_context*)::handler>, id=...) at /usr/src/debug/bmcweb/1.0+git/redfish-core/include/event_service_manager.hpp:537 resHandler=..., keepAlive=false, connId=0, res=...) at /usr/src/debug/bmcweb/1.0+git/http/http_client.hpp:803 ... at /usr/src/debug/bmcweb/1.0+git/http/http_client.hpp:461 at /usr/src/debug/bmcweb/1.0+git/http/http_client.hpp:440 bytesTransferred=<optimized out>) at /usr/src/debug/bmcweb/1.0+git/http/http_client.hpp:398 ```
So, we would need to hold the subscription object until resHandler() is completed by holding up using `shared_from_this()` for sendEventToSubscriber()..
``` bool Subscription::sendEventToSubscriber(std::string&& msg) { client->sendDataWithCallback( ... std::bind_front(&Subscription::resHandler, this, shared_from_this())); <=== ```
Tested: - Compiles - Event Listener works - Attempt to delete subscriptions
Change-Id: I5172c96e9d1bd2f03831916a95167e0ea532e9f2 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
show more ...
|
#
5ffbc9ae
|
| 24-Apr-2025 |
Gunnar Mills <gmills@us.ibm.com> |
Use SPDX identifiers everywhere
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/74513 moved most places over to SPDX but forgot a few, fix the ones found with grep.
SPDX identifiers are simpler, and
Use SPDX identifiers everywhere
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/74513 moved most places over to SPDX but forgot a few, fix the ones found with grep.
SPDX identifiers are simpler, and reduce the amount of cruft we have in code files. They are recommended by linux foundation, and therefore we should do as they allow.
This patchset does not intend to modify any intent on any existing copyrights or licenses, only to standardize their inclusion.
[1] https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects
Change-Id: Ie4c2ea53f7bc8d902bf87fef6df2a67c6b1de613 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
show more ...
|
#
4a19a7b5
|
| 27-Jan-2025 |
Ed Tanous <etanous@nvidia.com> |
Deduplicate event ids
Redfish specification states: ``` The value of the id field shall be the same as the Id property in the event payload. The value of the Id property in the event payload should
Deduplicate event ids
Redfish specification states: ``` The value of the id field shall be the same as the Id property in the event payload. The value of the Id property in the event payload should be the same as the EventId property of the last event record in the Events array. The value of the EventId property for an event record should be a positive integer value and should be generated in a sequential manner. ```
The event service code did not implement that correctly. So: 1. Add ID fields for all events. 2. Remove the per-sse connection id field and rely solely on EventServiceManager. 3. Make sure all paths, (including metric report) are generating an event id that's based on the eventservice event id
Tested: Redfish event listener now sees events populated. LastEventId when sent to the SSE socket now sees a contiguous id.
``` uri=$(curl -s --user "root:0penBmc" -k "https://192.168.7.2/redfish/v1/EventService" | jq -r .ServerSentEventUri) curl -u root:0penBmc -vvv -k -N -H "Accept: text/event-stream" -H "Last-Event-Id: 0" "https://192.168.7.2$uri" ```
Change-Id: Ic32e036f40a53a9b2715639ae384d7891c768260 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
0309c216
|
| 10-Jan-2025 |
Igor Kanyuka <ifelmail@gmail.com> |
Improve subscriptions logging
If the event is not sent to the destination it was supposed to be sent to, it's hard to find out why it was not sent, and what was the message content the code was work
Improve subscriptions logging
If the event is not sent to the destination it was supposed to be sent to, it's hard to find out why it was not sent, and what was the message content the code was working with. Having additional logging (mostly debug) helps with troubleshooting.
Tested: Built an image with these changes, ran in QEMU, enabled debug logging, setup subscription: ``` { "@odata.id": "/redfish/v1/EventService/Subscriptions/3489160873", "@odata.type": "#EventDestination.v1_14_1.EventDestination", "Context": "127.0.0.1", "DeliveryRetryPolicy": "RetryForever", "Destination": "http://127.0.0.1:8888/events", "EventFormatType": "Event", "HeartbeatIntervalMinutes": 10, "HttpHeaders": [], "Id": "3489160873", "MessageIds": [], "MetricReportDefinitions": [], "Name": "Event Destination 3489160873", "Protocol": "Redfish", "RegistryPrefixes": [], "ResourceTypes": [], "SendHeartbeat": false, "SubscriptionType": "RedfishEvent", "VerifyCertificate": true } ```
and sent a message: ``` root@bmc:~# busctl call xyz.openbmc_project.Logging \ /xyz/openbmc_project/logging \ xyz.openbmc_project.Logging.Create \ Create 'ssa{ss}' \ OpenBMC.0.1.PowerButtonPressed \ xyz.openbmc_project.Logging.Entry.Level.Error 0
o "/xyz/openbmc_project/logging/entry/16" ```
Got this in the log: ``` Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:65] Handling new DBus Event Log Entry Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface org.freedesktop.DBus.Peer Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface org.freedesktop.DBus.Introspectable Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface org.freedesktop.DBus.Properties Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface xyz.openbmc_project.Common.FilePath Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface xyz.openbmc_project.Software.Version Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface xyz.openbmc_project.Association.Definitions Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface xyz.openbmc_project.Object.Delete Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:74] Found dbus interface xyz.openbmc_project.Logging.Entry Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG dbus_log_watcher.cpp:59] Found Event Log Entry Id=16, Timestamp=, Message= Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG subscription.cpp:283] Processing logEntry: 16, '' Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG event_log.cpp:134] formatEventLogEntry: could not find messageID '' for log entry 16 in registry Jan 13 04:13:13 bmc bmcwebd[823]: [WARNING subscription.cpp:292] Read eventLog entry failed Jan 13 04:13:13 bmc bmcwebd[823]: [DEBUG subscription.cpp:317] No log entries available to be transferred. ```
Change-Id: I5cc8d48a0258f2419a7bd4f726f185abbd628110 Signed-off-by: Igor Kanyuka <ifelmail@gmail.com>
show more ...
|
#
f2656d1b
|
| 13-Jan-2025 |
Alexander Hansen <alexander.hansen@9elements.com> |
ci: fix ci ubasan failure
remove an unused std::shared_ptr<Subscription>& from void Subscription::resHandler(...)
Since it was just a reference, it was non-owning anyways and removing it should not
ci: fix ci ubasan failure
remove an unused std::shared_ptr<Subscription>& from void Subscription::resHandler(...)
Since it was just a reference, it was non-owning anyways and removing it should not have any impact to the lifetime of the managed object.
Tested: Inspection only.
Change-Id: Iab57e456d5a7ae32305e1a38ddcc37c0f0156ed4 Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
show more ...
|
#
4ac78946
|
| 02-Dec-2024 |
Ed Tanous <etanous@nvidia.com> |
Add content type to HTTP events
Some receiving servers require that content-type be sent. The Redfish specification does not clarify whether or not content-type should be specified, but the HTTP RF
Add content type to HTTP events
Some receiving servers require that content-type be sent. The Redfish specification does not clarify whether or not content-type should be specified, but the HTTP RFC makees it clear, as does security guidelines.
Tested: Set up Redfish-Event-Listener and modify to print headers. Observe that application/json header is now set when events are submitted to the server.
Change-Id: Idc96848e04f185743b14bd345d46418d38f5f5b1 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
81ee0e74
|
| 20-Dec-2024 |
Chandramohan Harkude <Chandramohan.harkude@gmail.com> |
Update Submit Test event feature to send custom data
Changes Added : Updated the submit test event feature to send test data as per spec
https://www.dmtf.org/sites/default/files/standards/documents
Update Submit Test event feature to send custom data
Changes Added : Updated the submit test event feature to send test data as per spec
https://www.dmtf.org/sites/default/files/standards/documents/ DSP2046_2019.1.pdf
Testing :
Tested sending custom test data and same data received at the event listener Change-Id: I2c2363a676aafd39c121c9fe4e16402c0f5961e2 Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
show more ...
|
#
fb546105
|
| 29-Oct-2024 |
Myung Bae <myungbae@us.ibm.com> |
Implement Subscription Heartbeat Logic
This implements the subscription heartbeat logic which will send the message `RedfishServiceFunctional` periodically with the interval of `HeartbeatIntervalMin
Implement Subscription Heartbeat Logic
This implements the subscription heartbeat logic which will send the message `RedfishServiceFunctional` periodically with the interval of `HeartbeatIntervalMinutes` specified in subscription property [1][2], if `SendHeartbeat` is enabled..
Note the heartbeat enablement is per event destination as DMTF specifies [3] like ``` ... This message shall only be sent if specifically requested by an event destination during the creation of a subscription... ```
This also add `HeartbeatEvent` to supported registry prefixes like ``` curl -k -X GET https://${bmc}/redfish/v1/EventService/ { ... "RegistryPrefixes": [ "Base", "OpenBMC", "TaskEvent", "HeartbeatEvent" ], "ResourceTypes": [ "Task", "Heartbeat" ], ```
Tested:
1) A single subscription and heartbeat via Redfish Event Listener
- Create a subscription via Redfish Event Listener - PATCH `SendHeartbeat=true` and `HeartbeatIntervalMinutes` like
``` curl -k -X PATCH https://${bmc}/redfish/v1/EventService/Subscriptions/${SUBID} \ -H "Content-Type: application/json" \ -d '{"SendHeartbeat":true, "HeartbeatIntervalMinutes":1}' ```
- Monitor the Redfish Event Listener and check the following heartbeat messages periodically (per HeartbeatIntervalMinutes)
``` response_type: POST headers: {'Host': '9.3.62.209', 'Content-Length': '230'}
response={ "@odata.type": "#Event.v1_4_0.Event", "Events": [ { "@odata.type": "#Message.v1_1_1.Message", "EventId": "HeartbeatId", "EventTimestamp": "2024-11-21T12:21:47+00:00", "MemberId": "0", "Message": "Redfish service is functional.", "MessageArgs": [], "MessageId": "HeartbeatEvent.1.0.1.RedfishServiceFunctional", "MessageSeverity": "OK", "OriginOfCondition": "/redfish/v1/EventService/Subscriptions/1521743607", "Resolution": "None." } ], "Id": "HeartbeatId", "Name": "Event Log" } ```
- Change `SendHeartbeat` to false and see whether the heartbeat message is stopped.
2) Multiple sbscribers with the different heartbeat setups
- create 2 event listeners with 2 different destinations (e.g., port 8080 and 8081). - Patch sendheartbeat=true to only one subscriber. - Check whether the only subscriber that enables `SendHeartbeat` is receiving the heartbeat messages.
3) Redfish Service Validator passes
[1] https://github.com/openbmc/bmcweb/blob/02ea923f13de196726ac2f022766a6f80bee1c0a/redfish-core/schema/dmtf/json-schema/EventDestination.v1_15_0.json#L356 [2] https://redfish.dmtf.org/registries/HeartbeatEvent.1.0.1.json [3] https://github.com/DMTF/Redfish/blob/d9e54fc8393d8930bd42e8b134741f5051a2680f/registries/HeartbeatEvent.1.0.1.json#L14
Change-Id: I8682e05f4459940913ba189f1ed016874e38dd4a Signed-off-by: Myung Bae <myungbae@us.ibm.com>
show more ...
|
#
b80ba2e4
|
| 18-Nov-2024 |
Alexander Hansen <alexander.hansen@9elements.com> |
Refactor: extract src/event_log.cpp
event_service_manager.hpp contains namespace 'event_log' which is confusing. Extract it to a separate header and cpp file to have the filename match the namespace
Refactor: extract src/event_log.cpp
event_service_manager.hpp contains namespace 'event_log' which is confusing. Extract it to a separate header and cpp file to have the filename match the namespace.
No functional changes have been made to the code.
Tested: - Using Redfish Event Listener, test subscriptions and eventing. - Redfish Service Validator passes
Change-Id: Ia0bf658b8b46f92aede059d46e8de48f160e073e Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com> Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
02c1e29f
|
| 15-Nov-2024 |
Alexander Hansen <alexander.hansen@9elements.com> |
Refactor: break up event_service_manager.hpp
'class Subscription' can be extracted into a separate file.
No changes have been made to the code.
Tested:
- Using Redfish Event Listener, test subscr
Refactor: break up event_service_manager.hpp
'class Subscription' can be extracted into a separate file.
No changes have been made to the code.
Tested:
- Using Redfish Event Listener, test subscriptions and eventing. - Redfish Service Validator passes
Change-Id: Id0076ef617e36cbb85629a386a4511a4fdb5e4da Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
show more ...
|