DMTF / libredfish

libRedfish is a C client library that allows for Creation of Entities (POST), Read of Entities (GET), Update of Entities (PATCH), Deletion of Entities (DELETE), running Actions (POST), receiving events, and providing some basic query abilities.
Other
48 stars 22 forks source link

redfishtest failed with timeout (CURL returned 28) when CURLOPT_FORBID_REUSE=0 #54

Closed glimchb closed 5 years ago

glimchb commented 5 years ago

I'm running redfish test to PowerEdge server like this:

./bin/redfishtest -vvv -H "https://idrac-ip-address" -u root -p password -M GET /v1/Chassis/Members[0]/Thermal

And get this timeout error (CURL returned 28):

addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x96f1b0
addRequestHeader: Adding User-Agent => libredfish to 0x96f1b0
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x96f1b0
asyncHeaderCallback: Adding OData-Version => 4.0 to (nil)
asyncHeaderCallback: Adding Keep-Alive => timeout=60, max=199 to 0x7f13e410fc70
asyncHeaderCallback: Adding Content-Type => application/json; charset=utf-8 to 0x7f13e410fc70
asyncHeaderCallback: Adding Server => Appweb/4.5.4 to 0x7f13e410fc70
asyncHeaderCallback: Adding Date => Wed, 28 Nov 2018 01 to 0x7f13e410fc70
asyncHeaderCallback: Adding Cache-Control => no-cache to 0x7f13e410fc70
asyncHeaderCallback: Adding Connection => Keep-Alive to 0x7f13e410fc70
asyncHeaderCallback: Adding Access-Control-Allow-Origin => * to 0x7f13e410fc70
asyncHeaderCallback: Adding Transfer-Encoding => chunked to 0x7f13e410fc70
asyncHeaderCallback: Adding Accept-Ranges => bytes to 0x7f13e410fc70
rawAsyncWorkThread: Got response for url https://idrac-ip-address/redfish with code 200
freeHeaders: Freeing 0x96f1b0
freeHeaders: Freeing 0x7f13e410fc70
addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x96f390
addRequestHeader: Adding User-Agent => libredfish to 0x96f390
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x96f390
asyncHeaderCallback: Adding OData-Version => 4.0 to (nil)
asyncHeaderCallback: Adding Keep-Alive => timeout=60, max=198 to 0x7f13e4138f30
asyncHeaderCallback: Adding Content-Type => application/json;odata.metadata=minimal;charset=utf-8 to 0x7f13e4138f30
asyncHeaderCallback: Adding Server => Appweb/4.5.4 to 0x7f13e4138f30
asyncHeaderCallback: Adding Date => Wed, 28 Nov 2018 01 to 0x7f13e4138f30
asyncHeaderCallback: Adding Cache-Control => no-cache to 0x7f13e4138f30
asyncHeaderCallback: Adding Content-Length => 789 to 0x7f13e4138f30
asyncHeaderCallback: Adding Connection => Keep-Alive to 0x7f13e4138f30
asyncHeaderCallback: Adding Access-Control-Allow-Origin => * to 0x7f13e4138f30
asyncHeaderCallback: Adding Accept-Ranges => bytes to 0x7f13e4138f30
rawAsyncWorkThread: Got response for url https://idrac-ip-address/redfish/v1/ with code 200
addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x7f13e413a550
addRequestHeader: Adding User-Agent => libredfish to 0x7f13e413a550
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x7f13e413a550
freeHeaders: Freeing 0x96f390
freeHeaders: Freeing 0x7f13e4138f30
rawAsyncWorkThread: CURL returned 28
getPayloadFromAsyncResponse: Error, called without response data...
Got a failure, httpCode = 65535
freeHeaders: Freeing 0x7f13e413a550
freeHeaders: Freeing (nil)

If I apply this patch:

diff --git a/src/asyncRaw.c b/src/asyncRaw.c
index 781acad..57c0d00 100644
--- a/src/asyncRaw.c
+++ b/src/asyncRaw.c
@@ -225,6 +225,7 @@ threadRet rawAsyncWorkThread(void* data)
     }
     //curl_easy_setopt(curl, CURLOPT_VERBOSE, true);
     //curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+    curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
     curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
     curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlWriteMemory);

I get a correct response:

addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x7781b0
addRequestHeader: Adding User-Agent => libredfish to 0x7781b0
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x7781b0
asyncHeaderCallback: Adding OData-Version => 4.0 to (nil)
asyncHeaderCallback: Adding Keep-Alive => timeout=60, max=199 to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Content-Type => application/json; charset=utf-8 to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Server => Appweb/4.5.4 to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Date => Wed, 28 Nov 2018 01 to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Cache-Control => no-cache to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Connection => Keep-Alive to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Access-Control-Allow-Origin => * to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Transfer-Encoding => chunked to 0x7f7c9c10fbe0
asyncHeaderCallback: Adding Accept-Ranges => bytes to 0x7f7c9c10fbe0
rawAsyncWorkThread: Got response for url https://idrac-ip-address/redfish with code 200
freeHeaders: Freeing 0x7781b0
freeHeaders: Freeing 0x7f7c9c10fbe0
addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x778390
addRequestHeader: Adding User-Agent => libredfish to 0x778390
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x778390
asyncHeaderCallback: Adding OData-Version => 4.0 to (nil)
asyncHeaderCallback: Adding Keep-Alive => timeout=60, max=199 to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Content-Type => application/json;odata.metadata=minimal;charset=utf-8 to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Server => Appweb/4.5.4 to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Date => Wed, 28 Nov 2018 01 to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Cache-Control => no-cache to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Content-Length => 789 to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Connection => Keep-Alive to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Access-Control-Allow-Origin => * to 0x7f7c9c138ea0
asyncHeaderCallback: Adding Accept-Ranges => bytes to 0x7f7c9c138ea0
rawAsyncWorkThread: Got response for url https://idrac-ip-address/redfish/v1/ with code 200
addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x7f7c9c138f40
addRequestHeader: Adding User-Agent => libredfish to 0x7f7c9c138f40
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x7f7c9c138f40
freeHeaders: Freeing 0x778390
freeHeaders: Freeing 0x7f7c9c138ea0
asyncHeaderCallback: Adding OData-Version => 4.0 to (nil)
asyncHeaderCallback: Adding Keep-Alive => timeout=60, max=199 to 0x7f7c9c112750
asyncHeaderCallback: Adding Content-Type => application/json;odata.metadata=minimal;charset=utf-8 to 0x7f7c9c112750
asyncHeaderCallback: Adding Server => Appweb/4.5.4 to 0x7f7c9c112750
asyncHeaderCallback: Adding Date => Wed, 28 Nov 2018 01 to 0x7f7c9c112750
asyncHeaderCallback: Adding Cache-Control => no-cache to 0x7f7c9c112750
asyncHeaderCallback: Adding Content-Length => 284 to 0x7f7c9c112750
asyncHeaderCallback: Adding Connection => Keep-Alive to 0x7f7c9c112750
asyncHeaderCallback: Adding Access-Control-Allow-Origin => * to 0x7f7c9c112750
asyncHeaderCallback: Adding Accept-Ranges => bytes to 0x7f7c9c112750
rawAsyncWorkThread: Got response for url https://idrac-ip-address/redfish/v1/Chassis with code 200
addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x7f7c9c112770
addRequestHeader: Adding User-Agent => libredfish to 0x7f7c9c112770
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x7f7c9c112770
freeHeaders: Freeing 0x7f7c9c138f40
freeHeaders: Freeing 0x7f7c9c112750
asyncHeaderCallback: Adding OData-Version => 4.0 to (nil)
asyncHeaderCallback: Adding Keep-Alive => timeout=60, max=199 to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Content-Type => application/json;odata.metadata=minimal;charset=utf-8 to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Server => Appweb/4.5.4 to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Date => Wed, 28 Nov 2018 01 to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Cache-Control => no-cache to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Content-Length => 1928 to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Allow => POST,PATCH to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Connection => Keep-Alive to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Access-Control-Allow-Origin => * to 0x7f7c9c11bbe0
asyncHeaderCallback: Adding Accept-Ranges => bytes to 0x7f7c9c11bbe0
rawAsyncWorkThread: Got response for url https://idrac-ip-address/redfish/v1/Chassis/System.Embedded.1 with code 200
addRequestHeader: Adding Accept => application/json to (nil)
addRequestHeader: Adding OData-Version => 4.0 to 0x7f7c9c11bc60
addRequestHeader: Adding User-Agent => libredfish to 0x7f7c9c11bc60
addRequestHeader: Adding Authorization => Basic cm9vdDpjYWx2aW4= to 0x7f7c9c11bc60
freeHeaders: Freeing 0x7f7c9c112770
freeHeaders: Freeing 0x7f7c9c11bbe0
asyncHeaderCallback: Adding OData-Version => 4.0 to (nil)
asyncHeaderCallback: Adding Keep-Alive => timeout=60, max=199 to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Content-Type => application/json;odata.metadata=minimal;charset=utf-8 to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Server => Appweb/4.5.4 to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Date => Wed, 28 Nov 2018 01 to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Cache-Control => no-cache to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Content-Length => 6979 to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Connection => Keep-Alive to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Access-Control-Allow-Origin => * to 0x7f7c9c11a6b0
asyncHeaderCallback: Adding Accept-Ranges => bytes to 0x7f7c9c11a6b0
rawAsyncWorkThread: Got response for url https://idrac-ip-address/redfish/v1/Chassis/System.Embedded.1/Thermal with code 200
...
...
...

RedfishTool works as expected in the same environment:

redfishtool -vvv -r idrac-ip-address -u root -p calvin Chassis -I System.Embedded.1 Thermal
#REQUEST: Transport:SendRecv:    GET http://idrac-ip-address/redfish/v1/
#REQUEST: Transport:SendRecv:    GET https://idrac-ip-address/redfish/v1/Chassis
#REQUEST: Transport:SendRecv:    GET https://idrac-ip-address/redfish/v1/Chassis/System.Embedded.1
#REQUEST: Transport:SendRecv:    GET https://idrac-ip-address/redfish/v1/Chassis/System.Embedded.1/Thermal
...
...

Please advise

pboyd04 commented 5 years ago

Which iDRAC version are you using? This works fine against the 4 or 5 iDRACs I know the IP of off the top of my head.

glimchb commented 5 years ago

image

pboyd04 commented 5 years ago

This was fixed in a later iDRAC release (you are several versions out of date). I can probably add a work around for this if you need to use this version of iDRAC, but I'd recommend you update your iDRAC version to the latest.

glimchb commented 5 years ago

Thanks for you patch and quick answer