'Long-running process gets SIGINT terminated, help analyze strace
I have a script that fetches data from the internet.
It uses commander, axios, https-proxy-agent, pg and a bunch of other modules, probably unrelated to the issue.
The logic is not complicated: get a list of URLs from the DB, loop downloading data using a proxy and saving it back to the DB, exit.
It works fine, except sometimes the script exits in the middle of the job.
No errors, just sudden termination. I haven't found a way to replicate it reliably.
When launched through an IDEA debugger, the final message reads:
^C
Process finished with exit code 130 (interrupted by signal 2: SIGINT)
I haven't pressed Ctrl+C, just in case.
strace final lines are:
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
+++ killed by SIGINT +++
There's a SIGINT handler attached to process. It runs if I interrupt the script manually, but not when it happens by itself.
Attached are 2 excerpts from strace output: one when things are working as expected and the other is the final output before the script is terminated.
It looks like things break when it comes to these lines:
epoll_wait(13, [{events=EPOLLIN, data={u32=19, u64=19}}], 1024, 8131) = 1
read(19, "", 65536) = 0
19 is a socket descriptor.
Could anyone help to figure out what is going on exactly and why the process is terminated, please?
Kubuntu 21.10, Node.js 16.13.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
