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

nrepl-server-filter called, even though process buffer is dead #1578

Closed
jonpither opened this issue Feb 18, 2016 · 4 comments
Closed

nrepl-server-filter called, even though process buffer is dead #1578

jonpither opened this issue Feb 18, 2016 · 4 comments

Comments

@jonpither
Copy link
Contributor

Trying to debug #390. This may or may not be related:

I often see an error when I kill CIDER in windows using cider-quit:

Debugger entered--Lisp error: (error "Selecting deleted buffer"))
nrepl-server-filter(#<process nrepl-server> "^CTerminate batch job (Y/N)? ")

This happens inside of nrepl-server-filter, specifically the line:

(with-current-buffer (process-buffer process))

TBH my knowledge of process buffers and sentinels etc is a bit naive. But it seems to me that CIDER kills the process buffer, yet this server-filter is still hanging around to intercept output from the nREPL process which is still on-going, in particular the output "Terminate batch job (Y/N)", which always happens on windows when you try to exit from batch jobs (.bat files).

So my question is, a) can you help me understand how this nrepl-server-filter is being called for a process with a dead corresponding process buffer, and b) could CIDER have some defensive code? I.e. don't call with-current-buffer on a potentially dead buffer.

@Malabarba
Copy link
Member

So my question is, a) can you help me understand how this nrepl-server-filter is being called for a process with a dead corresponding process buffer, and

I'm never quite sure when it comes to Emacs+Windows+Subprocesses, so it is possible, and your analysis sounds reasonable.

b) could CIDER have some defensive code? I.e. don't call with-current-buffer on a potentially dead buffer.

If we are sure that this is happening (and I tend to agree), then yes, we should add defensive code (with comments explaining why).

@jonpither
Copy link
Contributor Author

Thanks. I'll try out some defensive code on Monday, when I'm back in a windows environment.

@Malabarba
Copy link
Member

Thanks. Feel free to open a PR when you have it. Should be a simple of matter of wrapping that code in a

;;; In Windows this can be false.
(when (buffer-live-p (process-buffer process))
  ...
  )

@jonpither
Copy link
Contributor Author

Yes I'll do it tomorrow

jonpither added a commit to jonpither/cider that referenced this issue Feb 26, 2016
jonpither added a commit to jonpither/cider that referenced this issue Feb 26, 2016
jonpither added a commit to jonpither/cider that referenced this issue Feb 26, 2016
bbatsov added a commit that referenced this issue Feb 28, 2016
[Fix #1578] Add a guard for missing process-buffer
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

2 participants