Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

Close open handlers on exit #135

Merged
merged 4 commits into from
May 6, 2018
Merged

Close open handlers on exit #135

merged 4 commits into from
May 6, 2018

Conversation

cgewecke
Copy link
Contributor

@cgewecke cgewecke commented May 5, 2018

Believe this safely resolves truffle 852 where migrations that rely on a connection to infura or other remote cluster fail to complete.

Ran examples of the problem with wtfnode which detects which handlers continue to run during a hang and saw both Timers (e.g. interval polling from web3 and provider-engine) and Sockets (provider-engine) being left open. These have close methods we can invoke on command exit.

Have also published this branch to darq-truffle@roderik and tested it against truffle develop and truffle console, everything works.

@cgewecke cgewecke requested a review from gnidan May 5, 2018 23:52
@gnidan
Copy link
Contributor

gnidan commented May 6, 2018

Did you test this on, say, running debug inside truffle console? Not sure if things could get wonky in places where commands run inside other commands

@cgewecke
Copy link
Contributor Author

cgewecke commented May 6, 2018

I just checked it out and didn't see anything obviously amiss - the debugger runs and comes back to the shell without crashing. You might have a better sense of what to try. . .

Also checked multi-window, logged develop sessions running the debugger and everything seemed fine - could repeatedly run commands etc.

When you say 'command inside of other commands' do you mean one layer deep? Are the outer commands available in the debugger?

@cgewecke cgewecke changed the title Force exit Close open handlers on exit May 6, 2018
@gnidan
Copy link
Contributor

gnidan commented May 6, 2018

I can only think of a hypothetical example, where console in the future might have some polling background handle or something, and running a command would kill that handle.

This is contrived, but in that case I could imagine this solution wouldn't work.

But the right answer is probably to make console commands run in their own processes anyway, so this should be fine.

@cgewecke
Copy link
Contributor Author

cgewecke commented May 6, 2018

@gnidan Agree - that's the only thing I can think of either and it seems like IPC isn't disturbed by this. Kind of a miracle.

@cgewecke
Copy link
Contributor Author

cgewecke commented May 6, 2018

Going to wait to get some feedback from truffle 852 before merging this anyway . . .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using infura in truffle and get Error: Invalid JSON RPC response: ""
2 participants