Skip to content

Launching a replxx-based application from a script results in poorly handled SIGSTOP #157

@theklopex

Description

@theklopex

(( I believe that Marcin Konarski died from COVID on 12/18/2021, if this is his father's X account:
https://x.com/marian_konarski/status/1604590361543905280 ))

replxx-based applications cannot handle CTRL-Z on Linux properly. This key combination sends SIGSTOP.
This situation is VERY bad if your application has multiple threads.

Steps to reproduce single-threaded:

  • Compile the examples in the replxx repository.
  • echo ./replxx-example-cxx-api > test.sh
  • chmod 777 ./test.sh
  • ./test.sh
  • At the replxx> prompt, press CTRL-Z.
  • It will ignore all of your remaining input, including CTRL-C. If you press CTRL-Z, then it will stop the application.
  • If you run "fg" it will continue running. If you have pressed CTRL-C between the two CTRL-Z presses, then the application will receive the SIGINT and exit.

Steps to reproduce multi-threaded:

  • Add code to cxx-api.cxx to create pthreads. (I created 6 threads.)
  • I made my code acquire a mutex in main, then create the 6 threads.
  • Each thread attempts to acquire the mutex lock. They block.
  • When main is ready to return, it releases the mutex and calls pthread_join() on the six threads.
  • Bottom line, the threads are doing nothing but existing.
  • Perform the steps in the single-threaded issue.
  • After the first CTRL-Z press, the application will not respond to any actions.
  • You can attach to the PID with gdb and send SIGCONT numerous times (signal SIGCONT) and the application will eventually return to running.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions