Skip to content

Fix deadlock when subprocess ended#104

Closed
davidlatwe wants to merge 1 commit intomottosso:masterfrom
davidlatwe:fix-subprocess-lock
Closed

Fix deadlock when subprocess ended#104
davidlatwe wants to merge 1 commit intomottosso:masterfrom
davidlatwe:fix-subprocess-lock

Conversation

@davidlatwe
Copy link
Collaborator

@davidlatwe davidlatwe commented Aug 18, 2020

Problem

After I closed the application that was launched from Allzpark, Allzpark freezed.
I found that it was because the self.stdout.emit(line.rstrip()) keep emitting empty lines.

Changed

Continue the loop if line is empty resolved the problem.

Also, I added bytes decode when running in Python 3, and fixed a typo on the way.

@davidlatwe davidlatwe requested a review from mottosso August 18, 2020 17:25
@davidlatwe
Copy link
Collaborator Author

Oh, not sure if it's relevant, my Allzpark was launched from a Rez resolved environment. (Maybe the problem was not related to the OS ?)

@davidlatwe
Copy link
Collaborator Author

Update
Just tested on Windows (with current master branch), same problem.
The application I launched was a simple python qt app, which only had a button to push on main window.

@mottosso
Copy link
Owner

Hmmmm. I'm a bit suspicious about the simplicity of the solution. Would prefer if you used this for a while, make sure there aren't any unforeseen issues with it. I remember having a similar problem/solution with Pyblish. For example, this wouldn't allow applications to emit newlines? And if an application is emitting empty lines and our loop responds with continue, won't we get an infinite loop? :O

@davidlatwe
Copy link
Collaborator Author

For example, this wouldn't allow applications to emit newlines? And if an application is emitting empty lines and our loop responds with continue, won't we get an infinite loop? :O

I remember I've tested this kind of case, and just tested it again for making sure, looks like no problem :D

d97efa78-35ce-4cec-bcbd-6d0447d97d7e

And in this test, the maya is printing "\n", which ends up printing two lines in console window.

89829306-5b1b-4df5-8e16-733d732d7a54

Would prefer if you used this for a while, make sure there aren't any unforeseen issues with it.

But yes, I would prefer that as well. As you can see in the above gif, currently I am still working with mock apps. :)

@mottosso
Copy link
Owner

Re mock apps: Ah yes. You're in for a treat once you find that Maya, Nuke, Houdini and just about any DCC have their own way of treating the terminal and STDOUT. Some use \r some use \n, some use \r\n some use EOF when they quit, some don't. Some don't print anything to a terminal under Windows, but do under Linux. Enjoy xD

@davidlatwe
Copy link
Collaborator Author

davidlatwe commented Oct 23, 2020

And if an application is emitting empty lines and our loop responds with continue, won't we get an infinite loop? :O

It actually did enter the infinite loop, but doesn't drag the resource much so I thought the problem was resolved (what was I thinking). Howerver the Allzpark's "Commands" page did say the process is still running and I possibly didn't notice that as well at the time being.. 🤕

@davidlatwe davidlatwe closed this Oct 23, 2020
@davidlatwe davidlatwe deleted the fix-subprocess-lock branch October 23, 2020 20:28
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 this pull request may close these issues.

2 participants