stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
211 stars 113 forks source link

fix: add mutex to http client #236

Closed Danile71 closed 1 year ago

Danile71 commented 1 year ago

Our test bmc have problem with parallel requests

random uri with error failed to retrieve some items: [{"link":"/redfish/v1/Systems/Self/EthernetInterfaces/EthernetInterface0","error":"403: \u003c?xml version=\"1.0\" encoding=\"iso-8859-1\"?\u003e\n\u003c!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\u003e\n\u003chtml xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"\u003e\n \u003chead\u003e\n \u003ctitle\u003e403 - Forbidden\u003c/title\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003ch1\u003e403 - Forbidden\u003c/h1\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n"},{"link":"/redfish/v1/Systems/Self/EthernetInterfaces/EthernetInterface1","error":"403: \u003c?xml version=\"1.0\" encoding=\"iso-8859-1\"?\u003e\n\u003c!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\u003e\n\u003chtml xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"\u003e\n \u003chead\u003e\n \u003ctitle\u003e403 - Forbidden\u003c/title\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003ch1\u003e403 - Forbidden\u003c/h1\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n"}]

Danile71 commented 1 year ago

@stmcginnis If I parallel get info about managers and systems, and etc.. I have that bug. Not only CollectCollection. In my opinion, bug in bmc firmware.

stmcginnis commented 1 year ago

Perhaps we should always use a mutex when sending a request then. It would be safer, and I don't think it would add too much overhead to the call.

Danile71 commented 1 year ago

@stmcginnis complete

stmcginnis commented 1 year ago

Thanks a lot!