Node-RED plugin: Troubleshooting - repeated calls, missing properties and broken pipe issues

Hi, I have the following Node-RED flow:

When I press the inject button, I get the following output in the host console:

[worker thread 2 ]       http_request.cpp:79    INFO[HTTP CLIENT REQUEST] POST /inject/1900e272c2cb2b61
[worker thread 2 ]http_client_connection.:284   ERRerror while writing to socket: Broken pipe
[worker thread 2 ]       http_request.cpp:79    INFO[HTTP CLIENT REQUEST] POST /inject/1900e272c2cb2b61
[worker thread 2 ]      http_response.cpp:156   INFO[HTTP CLIENT RESPONSE] HTTP/1.1 200 OK
[worker thread 2 ]      http_response.cpp:156   INFO[SENDING RESPONSE] HTTP/1.1 200 OK
[worker thread 1 ]       http_request.cpp:79    INFO[RECEIVED REQUEST] GET /v3/users/user_name/devices/device_ID/properties
[worker thread 1 ]        api_request.cpp:316   WARNcannot find required parameter: property
[worker thread 1 ]      http_response.cpp:156   INFO[SENDING RESPONSE] HTTP/1.1 200 OK
[worker thread 1 ]       http_request.cpp:79    INFO[RECEIVED REQUEST] PUT /v3/users/user_name/devices/device_ID/properties/property_name

Each time I initiate an injection, I first encounter a ā€œBroken pipeā€ error. After this, the injection appears to repeat automatically and succeeds on the second attempt. Following this, the system attempts to update a device property, but initially, the property name is missing, resulting in a warning. On the next attempt, the property name is correctly forwarded, and the process completes successfully.

When attempting to read the deviceā€™s properties in a similar flow, I encounter only a ā€œBroken pipeā€ error.

This is just one example, but it highlights a pattern of redundant or potentially incorrect calls, possibly pointing to a misconfiguration or an issue in the Node-RED flow.

Questions:

  1. Has anyone else encountered similar behavior with unnecessary or repeated calls in their flow?
  2. Are there any adjustments required on the flow definition to eliminate the initial ā€œBroken pipeā€ and property missing issues?

Any insights or suggestions would be greatly appreciated!

Hi @aeromek

Iā€™ll split the log from your post in two in order to explain it and find potential issues.

First off:

[worker thread 2 ]       http_request.cpp:79    INFO[HTTP CLIENT REQUEST] POST /inject/1900e272c2cb2b61
[worker thread 2 ]http_client_connection.:284   ERRerror while writing to socket: Broken pipe
[worker thread 2 ]       http_request.cpp:79    INFO[HTTP CLIENT REQUEST] POST /inject/1900e272c2cb2b61
[worker thread 2 ]      http_response.cpp:156   INFO[HTTP CLIENT RESPONSE] HTTP/1.1 200 OK

The request /inject/1900e272c2cb2b61 is executed from Node-RED frontend when the inject is clicked. I am not sure for the reason on the Broken Pipe message and why it tries again, as I havenā€™t been able to reproduce it. In my case only one inject request is done with a successful result. Example:

2024-11-04 11:31:14.886 (2938690.375s) [worker thread 1 ]       http_request.cpp:79    INFO[RECEIVED REQUEST] POST /users/thinger/plugins/node-red/inject/b66f728a102cc653
2024-11-04 11:31:14.887 (2938690.376s) [worker thread 1 ]       http_request.cpp:79    INFO[HTTP CLIENT REQUEST] POST /inject/b66f728a102cc653
2024-11-04 11:31:14.889 (2938690.379s) [worker thread 1 ]      http_response.cpp:156   INFO[HTTP CLIENT RESPONSE] HTTP/1.1 200 OK
2024-11-04 11:31:14.890 (2938690.379s) [worker thread 1 ]      http_response.cpp:156   INFO[SENDING RESPONSE] HTTP/1.1 200 OK

We may need more information in order to be able to analyze it, if you donā€™t mind sharing your instance hostname with me through a private message or through our support channel (https://support.thinger.io) we will take a look at it.

As for the second part of the log:

[worker thread 1 ]       http_request.cpp:79    INFO[RECEIVED REQUEST] GET /v3/users/user_name/devices/device_ID/properties
[worker thread 1 ]        api_request.cpp:316   WARNcannot find required parameter: property
[worker thread 1 ]      http_response.cpp:156   INFO[SENDING RESPONSE] HTTP/1.1 200 OK
[worker thread 1 ]       http_request.cpp:79    INFO[RECEIVED REQUEST] PUT /v3/users/user_name/devices/device_ID/properties/property_name

The property write node always checks first if the property exists in order to create it or just update its contents. That is why you are seeing a GET request on the devices properties and then a PUT request in order to update its contents. You can see the source code here: node-red-contrib-thinger/nodes/property-write.js at 1.8.0 Ā· thinger-io/node-red-contrib-thinger Ā· GitHub

As for the warning, there is nothing to worry about, as it it just an informative message from thingers backend that means that the GET request to the /properties endpoint could also contain the name of the property like /properties/<property>

Let me know if you have any doubts

Hi @aeromek

After further analyzing the logs and causes of the Broken pipe, I can assure you that there is no reason to worry.

What that log message is trying to say is that a previous HTTP connection that was thought to be open by the Thinger server (acting in this case as a proxy between the client/browser and Node-RED backend), seems to have been closed by Node-RED backend. On request failure due to the broken pipe (closed connection), the connection is reopened again against the Node-RED backend, and the original request is resent successfully.

Far from being an issue, the Thinger Server proxy tries to keep this connections alive to make future requests faster and avoid reopening unless necessary.

Best Regardxs

1 Like

Thank you @jaimebs for your swift and detailed responses!

I appreciate the clarification on the ā€œBroken pipeā€ error and the property update behavior. I am very happy that these are not critical issues.

Thanks again for your support.

1 Like