openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
156 stars 131 forks source link

bmcweb service core-dump when GET /EventService/SSE #282

Closed awan119 closed 2 months ago

awan119 commented 2 months ago

Is this the right place to submit this?

Bug Description

Hi,

I have the problem that bmcweb.service would be core-dump when I want to GET /redfish/v1/EventService/SSE.

I tried 3 ways to GET SSE, but nothing works.

First is browser, google chrome and edge. Browser gets 404NotFound, owing to without having Accept: text/text/event-stream image

So second is using curl to GET SSE but no response from bmcweb.

test@build:~$ curl -I -k -H "X-Auth-Token: $token" -H "Accept: text/event-stream"  -X GET https://$/{bmc}/redfish/v1/EventService/SSE  
curl: (52) Empty reply from server

So the third method is using postman to send SSE. image After few seconds, response is nothing and with socket hang up. image I guess this is not Postman problem so I add some log inside bmcweb code to debug.

And the situation is below :

Jul 11 04:27:13 bmcweb[27553]: X test - bool isSse =0
Jul 11 04:27:13 bmcweb[27553]: X test - go to handle... - http_connection.hpp
Jul 11 04:27:14 bmcweb[27553]: X test - handle - http_connection.hpp
Jul 11 04:27:14 bmcweb[27553]: X test - getting SSE header
Jul 11 04:27:14 bmcweb[27553]: X test - bool isSse =1
Jul 11 04:27:14 bmcweb[27553]: X test - go to handleUpgrade - http_connection.hpp
Jul 11 04:27:14 bmcweb[27553]: X test - getNumberOfSSESubscriptions - event_service_manager.hpp
Jul 11 04:27:14 bmcweb[27553]: X test - createSubscription
Jul 11 04:27:14 bmcweb[27553]: X test - addSubscription - event_service_manager.hpp
Jul 11 04:27:14 bmcweb[27553]: X test - addSubscription - while()
Jul 11 04:27:14 bmcweb[27553]: X test - addSubscription - inserted.second=true
Jul 11 04:27:14 bmcweb[27553]: X test - addSubscription - writing newSub value     <<<HERE!!!
Jul 11 04:27:27 systemd[1]: bmcweb.service: Main process exited, code=dumped, status=11/SEGV
Jul 11 04:27:27 systemd[1]: bmcweb.service: Failed with result 'core-dump'.
Jul 11 04:27:27 systemd[1]: bmcweb.service: Consumed 51.655s CPU time.
Jul 11 04:27:27 systemd[1]: Started Start bmcweb server.
Jul 11 04:27:27 bmcweb[28805]: X test - serverSentEvent
Jul 11 04:27:27 bmcweb[28805]: X test - loadOldBehavior() - event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - initConfig- event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - initConfig- event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - subValue->updateRetryConfig - event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - initConfig- event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - initConfig- event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - subValue->updateRetryConfig - event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - initConfig- event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - initConfig- event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: X test - subValue->updateRetryConfig - event_service_manager.hpp
Jul 11 04:27:27 bmcweb[28805]: Checking certs in file /etc/ssl/certs/https/server.pem
Jul 11 04:27:27 bmcweb[28805]: Found an EC key

After writing newSub value in addSubscription function of event_service_manager.hpp, the core is dump. Jul 11 04:27:27 systemd[1]: bmcweb.service: Main process exited, code=dumped, status=11/SEGV Jul 11 04:27:27 systemd[1]: bmcweb.service: Failed with result 'core-dump'.

I am not sure about this situation. Hope someone could help. Thank you in advance.

Version

Because of development, we use version based on 3e7a8da60d70f4c42ae8ce0a3ecb0709194eb831
is committed at Nov,16, 2023.

The code structure is different from the last code, but it seems that most logic of subscription and SSE are similar.

Additional Information

addSubscription function works well if I use PUSH style subscription from postman.

ul 11 04:33:20 bmcweb[28805]: X test - go to handle... - http_connection.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - addSubscription - event_service_manager.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - addSubscription - while()
Jul 11 04:33:20 bmcweb[28805]: X test - addSubscription - inserted.second=true
Jul 11 04:33:20 bmcweb[28805]: X test - addSubscription - writing newSub value      <<<HERE!!!
Jul 11 04:33:20 bmcweb[28805]: X test - writeData - persistent_data.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - for loop SessionStore - persistent_data.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - for loop EventServiceStore - persistent_data.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - for loop httpHeaders
Jul 11 04:33:20 bmcweb[28805]: X test - writing subValue
Jul 11 04:33:20 bmcweb[28805]: X test - for loop EventServiceStore - persistent_data.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - for loop httpHeaders
Jul 11 04:33:20 bmcweb[28805]: X test - writing subValue
Jul 11 04:33:20 bmcweb[28805]: X test - for loop EventServiceStore - persistent_data.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - for loop httpHeaders
Jul 11 04:33:20 bmcweb[28805]: X test - writing subValue
Jul 11 04:33:20 bmcweb[28805]: X test - for loop EventServiceStore - persistent_data.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - for loop httpHeaders
Jul 11 04:33:20 bmcweb[28805]: X test - writing subValue
Jul 11 04:33:20 bmcweb[28805]: X test - writing subValue DONE
Jul 11 04:33:20 bmcweb[28805]: X test - updateSubscriptionData() - event_service_manager.hpp
Jul 11 04:33:20 bmcweb[28805]: X test - addSubscription - ending

Below shows SSE is enabled under /redfish/v1/EventService node. image

edtanous commented 2 months ago

committed at Nov,16, 2023.

Please retest on master. your build is missing many fixes, some of which fixed bugs with identical reproductions as yours.

awan119 commented 2 months ago

@edtanous Hi,

Thank you for response. What will cause this problem?

edtanous commented 2 months ago

What will cause this problem?

Not using master. Please test the latest.

awan119 commented 2 months ago

I see. Thank you.

edtanous commented 2 months ago

did you retest on master?

awan119 commented 2 months ago

@edtanous Hi, Because of team developing plan, I will try the lastest code afterwards. I close ticket first. If I have any update, I'll post here. Thank you very much.