Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
theklopex opened this issue Jun 27, 2024 · 0 comments

Comments

@theklopex
Copy link

(( 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant