Problem with exec node output in Spawn mode

I uninstalled the nodes that gave warning messages in the log, now the startup log is clean

pi@raspberrypi:~ $ node-red-start

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.178.210:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
Started Node-RED graphical event wiring tool..
14 Feb 22:43:12 - [info]
Welcome to Node-RED
===================
14 Feb 22:43:12 - [info] Node-RED version: v3.0.2
14 Feb 22:43:12 - [info] Node.js  version: v16.19.0
14 Feb 22:43:12 - [info] Linux 4.19.66-v7+ arm LE
14 Feb 22:43:14 - [info] Loading palette nodes
14 Feb 22:43:18 - [info] Dashboard version 2.10.1 started at /ui
14 Feb 22:43:18 - [info] Settings file  : /home/pi/.node-red/settings.js
14 Feb 22:43:18 - [info] Context store  : 'default' [module=memory]
14 Feb 22:43:18 - [info] User directory : /home/pi/.node-red
14 Feb 22:43:18 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
14 Feb 22:43:18 - [warn] Flows file name not set. Generating name using hostname.
14 Feb 22:43:18 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
14 Feb 22:43:18 - [info] Server now running at http://127.0.0.1:1880/
14 Feb 22:43:18 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
14 Feb 22:43:19 - [info] Starting flows
14 Feb 22:43:19 - [info] Started flows

Is it possible to rename the post title?
from
"How to read the output of BIGEXEC nodes"
to
"How to read the output of EXEC / BIGEXEC node"

Yes, click on the pen by the title at the top.

The log looks fine, so it is all a bit odd.

If you kill the process (you can do that by sending in a message with msg.kill set, as described in the help text for the node) then does the output all appear?
If you set the exec node to output on completion and then kill the process does it all appear?

I can't find any pen, maybe too much time has passed,
it had to be done within the first few days

If Kill the process no 'printf' messages appear
just this message

Exec mode : msg : Object
object
_msgid: "2455c01b1300d406"
topic: "Exec mode"
payload: object
code: null
message: string
Command failed: /home/pi/RadioHead/examples/raspi/rf95/./rf95_server
signal: "SIGTERM"

I ran another simple test
to easily reproduce the problem, of which I'm looking for the solution

I created a small C program that prints messages every 3 sec ( test.c )

#include <stdio.h>
#include <unistd.h>

int main(){
 
   printf("Hello  1 \n"); 
   sleep(3);
   printf("Hello  2 \n"); 
   sleep(3);
   printf("Hello  3 \n"); 
   sleep(5);
         }

Running this simple program, I would expect to see "Hello" messages in the MSG node while it's running, but these only appear, all at once, when the program completes.

16/2/2023, 11:35:42node: MSG OUT
msg : Object
object
payload: string
Hello  1 
Hello  2 
Hello  3 
_msgid: "df5f8c79f71bc001"

@Colin ,what do you suggest,
should I open a new request post, with this simple program and exec node
or shall we continue here?

C may be buffering the output. Google suggests you can force a flush using
fflush(stdout);
after each printf.
Alternatively you may get the same effect by adding at the top
setbuf(stdout, NULL);

[Edit] I have edited the thread title for you.

Thanks a lot !

@Colin
I added the command

fflush(stdout);

after the line 'printf(......);' in the original C source of the LORA receiver

  if (rf95.recv(buf, &len)) {
            printf("Packet[%02d] #%d => #%d %ddB: ", len, from, to, rssi);
            printbuffer(buf, len);
            fflush(stdout);  //LP
          } else {
            Serial.print("receive failed");
          }
          printf("\n");
        }

works !!!
I can intercept messages arriving on my Raspberry LORA Gateway
and process them in Node-Red nodes

16/2/2023, 16:09:16node: 38f6c324aee3f8bf
Spawn mode : msg : Object
object
_msgid: "aa3831d610fac0de"
payload: "rf95_server↔RF95 CS=GPIO25, IRQ=GPIO4, RST=GPIO17, LED=GPIO255 OK NodeID=1 @ 868.00MHz↔Listening packet...↔Packet[16] #255 => #255 -25dB:  33 75 10 00 FF 05 18 00 66 66 A2 41 00 00 B0 42"
topic: "Spawn mode"
16/2/2023, 16:09:49node: 38f6c324aee3f8bf
Spawn mode : msg : Object
object
_msgid: "aa3831d610fac0de"
payload: "↔Packet[16] #255 => #255 -26dB:  33 75 10 00 90 04 19 00 66 66 A2 41 00 00 B0 42"
topic: "Spawn mode"

Thank you so much for the help you have given me
Good day

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.