0

I want to use the command kill -15 myprogin order to exit the program gracefully but when i use strace to see the trace i saw always this output killed by SIGSEGVdoes it mean an orrur occured ? and at which level and what are the reasons of that ?

here is what i saw with strace -- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=0, si_uid=0} --- that it tries to end the program but after that i got --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xcdab7de0} ---.

And before killing the program with strace i saw that it tries to read the time in an infinite loop clock_gettime(CLOCK_MONOTONIC, {tv_sec=91, tv_nsec=28973100}) = 0 clock_gettime(CLOCK_MONOTONIC, {tv_sec=91, tv_nsec=30093500}) = 0 clock_gettime(CLOCK_MONOTONIC, {tv_sec=91, tv_nsec=31405300}) = 0 gettid() = 337 write(1017, "F", 1) = 1 rt_sigprocmask(SIG_SETMASK, [PIPE], ~[ILL TRAP BUS FPE KILL SEGV STOP SYS], 8) = 0 could it be the cause ? Thanks in advance.

  • `SIGSEGV` is a symbol representing the signal delivered to a program if it attempts an invalid memory access. It is mnemonic for "segmentation violation", which these days is more often spelled "segmentation fault". So yes, if your program is killed by a `SIGSEGV` generated by the system then it means that an error occurred. – John Bollinger Nov 29 '22 at 22:50
  • @JohnBollinger that's not my point, i want to say am trying to kill my program with SIGTERM and waiting to see SIGTERM with strace, instead i'm seeing SIGSEGV – kakachi_hatake Nov 29 '22 at 23:28
  • I know. So again, the fact that you are seeing a death by `SIGSEGV` means that an error occurred. Unless the program raises the `SIGSEGV` explicitly itself (for example, via `raise(SIGSEGV)`). – John Bollinger Nov 29 '22 at 23:35
  • 1
    Since you say you intend to exit the program "gracefully", I'm supposing that you registered a handler for `SIGTERM`. Presumably, then, the segfault is occurring during the execution of that handler. Or else that handler returns instead of terminating the program via a call to (say) `exit()`, after having performed some teardown. Or that you have one or more exit handlers registered, and the segfault occurs there. Any way around, yes, an error occurred. This is the answer to the question you asked. – John Bollinger Nov 29 '22 at 23:40
  • Note also, however, that if you indeed did register a handler for `SIGTERM` then it runs *instead of* the default action for that signal (to terminate the program). In that case, you will never see "killed by SIGTERM" as the termination reason. – John Bollinger Nov 29 '22 at 23:41
  • @kakachi_hatake : No one will read this much trace information in a comment. You should edit your Q to include what is relevant to your problem. Good luck. – shellter Nov 30 '22 at 03:16

0 Answers0