Sometimes notify_closing can be called on dead events by A5rocks · Pull Request #3503 · python-trio/trio · GitHub
Skip to content

Sometimes notify_closing can be called on dead events - #3503

Merged
A5rocks merged 2 commits into
python-trio:mainfrom
A5rocks:notify-closing-race
Sep 17, 2026
Merged

A5rocks merged 2 commits into
python-trio:mainfrom
A5rocks:notify-closing-race

Conversation

@A5rocks

@A5rocks A5rocks commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Closes #3502 since this is the repro they were describing, I think.

@A5rocks
A5rocks force-pushed the notify-closing-race branch from 8e2fc98 to d887165 Compare September 5, 2026 00:38
@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

@A5rocks
A5rocks force-pushed the notify-closing-race branch from d887165 to b97da89 Compare September 5, 2026 05:55
@A5rocks

A5rocks commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

I'll close this in favor of the more general solution @arthur-tacca was proposing.

@A5rocks A5rocks closed this Sep 17, 2026
@A5rocks

A5rocks commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Gah, I forgot what this PR did. NVM!

@A5rocks A5rocks reopened this Sep 17, 2026

@CoolCat467 CoolCat467 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

From what I understand this is probably fine.

@A5rocks
A5rocks merged commit 50b9825 into python-trio:main Sep 17, 2026
139 checks passed
@A5rocks
A5rocks deleted the notify-closing-race branch September 17, 2026 02:12
@arthur-tacca

Copy link
Copy Markdown
Contributor

Sorry I just noticed that this only checks for ENOENT

                except OSError as e:
                    if e.errno == errno.ENOENT:  # pragma: no branch
                        # the event isn't in kqueue
                        continue

But for similar code in _wait_common, Trio currently checks for exc.errno in (errno.EBADF, errno.ENOENT). It says "FreeBSD reports this using EBADF. macOS uses ENOENT". Not sure if this applies to this situation too.

@A5rocks

A5rocks commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

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.

3 participants