-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
OSError: [Errno 9] Bad file descriptor #1021
Comments
The disconnect does work though, and I can reconnect again just fine... |
Nothing that OctoPrint can do anything about I fear. If it tries to close the serial line like it is supposed to and that causes an error, that's a problem on the operating system level, nothing I can handle in user space. I might be able to catch the error there and stop it from propagating, but I'm not sure if I should since it hints at a possible problem the user should investigate. |
It could be a user space error. It is saying self.fd is not a valid file On 11 August 2015 at 06:56, Gina Häußge [email protected] wrote:
|
Is there anything I can do to debug this or is it safe to just ignore? |
@nophead you are right, wrong perspective on my end. Still out of reach for OctoPrint though I fear, the error is raised within pyserial. @jminardi Can you reliably reproduce that? Or is that something that only happened once? If you can reliably reproduce it it might be worth looking further into what's causing that/under which specific circumstances it reproduces. Might make it easier to decide if action needs to be taken (in case of some timing issue) or not. In any case I'm still undecided on what the best course of action is here - should something like this be assumed "normal" and just logged within the closing function, or should it still raise that amount of noise. |
I can reliably reproduce it, happens every time I disconnect when using my mac laptop. I was not seeing the error on my raspi fwiw |
But only on the Mac? Hm... I have a Mac Mini here, I'll try to see if that behaves similar some time later this week (still working through the backlog from my two week vacation). |
Seems like it could be a race between the monitoring thread and another thread (api request perhaps)? It may only happen on a mac based on differences about when the library holds the lock. That code doesn't expect another thread to close and set _serial to None while this thread is in or returning from _readline. |
Readline could still be stuck in a read loop, leading to an exception on Mac when closing the connection from another thread. This should now be captured correctly. Fixes #1021
Otherwise we kill the beforePrinterDisconnected gcode script... See #1021
@markwal was right, it was a race condition that for whatever reason seems to be reliably reproducible on Macs and never said hello to me before on other systems. I introduced a new flag into the comm object that will now be set to True if the closing of the serial connection has been triggered and will prevent exceptions (that I can't prevent from occurring here since the I also added an error handler to the Fixed in |
Disconnecting from the printer
Printer to disconnect without error
printer disconnected with the error pasted below
Version: 1.3.0.dev179+g214b484 (HEAD branch)
also happens on latest master
(if applicable - always include if unsure):
Marlin Integration Branch
System running Browser (if applicable - always
include if unsure):
latest chrome on os x
(ALWAYS INCLUDE AND DO NOT TRUNCATE):
http://pastebin.com/UtZv4svz
gist.github.com or pastebin.com (if applicable - always
include if unsure or reporting communication issues AND
DO NOT TRUNCATE):
relevant error pasted below
on gist.github.com or pastebin.com or alternatively a
screenshot (if applicable - always include if unsure
or reporting UI issues):
n/a
include if unsure or reporting UI issues):
n/a
I have read the FAQ.
Error message:
The text was updated successfully, but these errors were encountered: