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

Connection to command socket is lost during run of samterm #75

Open
ckeen opened this issue Apr 23, 2018 · 1 comment · May be fixed by #130
Open

Connection to command socket is lost during run of samterm #75

ckeen opened this issue Apr 23, 2018 · 1 comment · May be fixed by #130

Comments

@ckeen
Copy link
Contributor

ckeen commented Apr 23, 2018

I could not narrow it down so far but sometimes the socket gets closed and removed from the filesystem. However the lock is still present, so one has to manually delete the lock file.

I suspect some EAGAIN failure on reading/writing to the descriptor but I have been unable to correctly trace this so far.

vtrlx added a commit to vtrlx/sam that referenced this issue Apr 29, 2024
Previously, using any command that forked sam would run the odd risk of causing sam's control socket to exit. This seems to be a consequence of using atexit() to schedule removal of the control socket from the file system.

This commit adds a global boolean named forked, which is set to true in child process after they are forked. The exit handlers removesocket() and rmsocket() are changed such that they don't remove the control sockets if the forked boolean is set to true.

Sam's control socket should only get removed once the main instance exits.

Fixes deadpixi#75
@vtrlx vtrlx linked a pull request Apr 29, 2024 that will close this issue
@vtrlx
Copy link

vtrlx commented Apr 29, 2024

I believe I've narrowed the issue down to the use of atexit().

From the function's man page,

When a child process is created via fork(2), it inherits copies of its parent's registrations. Upon a successful call to one of the exec(3) functions, all registrations are removed.

I suspected that the removal of registrations after an exec() was not actually being done, so I ran a small test.

  1. Start up Sam.
  2. Use the B shell command to open files in Sam, verifying it works.
  3. Use the ! command in Sam.
  4. Again use the B shell command, and it no longer functions.

I've opened a pull request with a naïve fix that seems to work, based on my using several shell commands in this session of Sam as well as many invocations of B from my shell… → #130

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

Successfully merging a pull request may close this issue.

2 participants