deadpixi / sam

An updated version of the sam text editor.
Other
433 stars 47 forks source link

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

Open ckeen opened 6 years ago

ckeen commented 6 years ago

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 commented 4 months ago

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