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

core: fix broken interrupt handling #1527

Merged
merged 1 commit into from
Apr 16, 2019

Conversation

HumorBaby
Copy link
Contributor

@dgw did a good job describing the issue in #1478, so I refer the reviewer there for the details.

The fixes provided here use simple checks to ensure 1) that a socket is present before attempting to send a QUIT message, and 2) a hasquit flag was not set on a bot instance during a disconnected phase.

Generally, in both cases, the issue was the signal setting the hasquit flag too late, and allowing a new while loop to begin. The bot would still have the hasquit flag set, but this would not be caught until a new Exception/signal.

sopel/irc.py Outdated Show resolved Hide resolved
@HumorBaby
Copy link
Contributor Author

grammar peeve 😢... will change connection --> connecting fix: interrupt during connection phase to fix: interrupt during connecting phase in subsequent pushes

@dgw
Copy link
Member

dgw commented Apr 1, 2019

I'd like to fix this in the 6.6.x release series, but am wary of the merge conflicts it would create because this fix would need to happen on 6.6.x in the old run_script.py file—deleted on master.

We're still at a point where fixes from 6.6.x are easier to merge into master than to cherry-pick. Otherwise it wouldn't be an issue. At some point I'll just… stop making 6.6.x releases, I guess, so we can all focus 100% on Sopel 7 without worrying about how changes will interact with the maintenance branch.

@dgw dgw added this to the 7.0.0 milestone Apr 1, 2019
@dgw dgw added the Bugfix Generally, PRs that reference (and fix) one or more issue(s) label Apr 1, 2019
@HumorBaby
Copy link
Contributor Author

I'd like to fix this in the 6.6.x release series, but am wary of the merge conflicts it would create because this...

But its sooo worth it! 😝 Funnily enough, I initially based this fix on an old master commit (pre-new Sopel CLI), and ended up redoing (copypasta into run.py) before the PR. Still have commits if you change your mind 😉

@dgw
Copy link
Member

dgw commented Apr 1, 2019

Oh hell, why not throw it in for 6.6.6… If the merge makes me regret it later, I'll just consider it a learning experience. The important thing will be squishing the bug. 😛

@HumorBaby
Copy link
Contributor Author

woohoo! Seriously though, I only say this b/c of #1478 (comment)

@dgw
Copy link
Member

dgw commented Apr 1, 2019

Time to make a new issue label here called "Affects: Docker" /s

Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved #1534? Approve #1527. They're equivalent.

If I'm feeling masochistic I'll merge this first, then the 6.6.x branch with its version of this fix. If not, I'll make you do the rebase @HumorBaby. 😜

@Exirel
Copy link
Contributor

Exirel commented Apr 9, 2019

I'm honestly quite impressed by how small the changes are. And it looks good so far!

@HumorBaby
Copy link
Contributor Author

Sad news 😢 I found another case where exit can be messy during testing for #1543: during the connection phase before the connection is accepted.

Test this by trying to connect to a server on a wrong port (where it is most likely not to be accepted, but not explicitly rejected).

@dgw
Copy link
Member

dgw commented Apr 12, 2019

Worth making a quick PR for 6.6.x so this can be fixed in the 6.6.6 release on Monday?

@HumorBaby
Copy link
Contributor Author

Yep.

@dgw
Copy link
Member

dgw commented Apr 12, 2019

Looks like only 1171e4e (required because of the sopel/run_script.py -> sopel/cli/run.py refactor from #1493) will be needed after 6.6.x is merged back to master. The other commits in this PR only touch sopel/irc.py, and will make it into master by way of #1534 and #1558.

@HumorBaby
Copy link
Contributor Author

Looks like only 1171e4e (required because of the sopel/run_script.py -> sopel/cli/run.py refactor from #1493) will be needed after 6.6.x is merged back to master

That’s a Texas-sized 10-4, good buddy.

Confirmed with local test merges. Preemptive squash coming right up...

@HumorBaby HumorBaby force-pushed the 1478-fix-broken-interrupt-handling branch from 3177610 to 7a3d66a Compare April 14, 2019 18:02
@dgw
Copy link
Member

dgw commented Apr 16, 2019

@HumorBaby Would you be put out if I asked to reference 9dd772d in this commit message? Like:

reapply fix: interrupt during disconnected phase (9dd772d)

Also, in "Because the time.sleep", there's a missing "of". :)

Optionally, also put a reference to #1493 in the message, since that's why this needs to be reapplied.

Because of the `time.sleep` during the disconnect phase, the signal
handling is thrown off and a new bot is spawned before the `bot.hasquit`
flag can be checked. Add a check at the top of the loop to see if the
`hasquit` flag was set during a disconnect.

Fixes sopel-irc#1478. Reapplied because of changes from sopel-irc#1493.
@HumorBaby HumorBaby force-pushed the 1478-fix-broken-interrupt-handling branch from 7a3d66a to ec9eeb7 Compare April 16, 2019 22:49
@HumorBaby
Copy link
Contributor Author

Would you be put out if I asked to reference 9dd772d in this commit message?

Too much. 🙃

@dgw
Copy link
Member

dgw commented Apr 16, 2019

Perfect!

@dgw dgw merged commit 92a0418 into sopel-irc:master Apr 16, 2019
@HumorBaby HumorBaby deleted the 1478-fix-broken-interrupt-handling branch April 18, 2019 11:38
@dgw dgw mentioned this pull request Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants