<p></p>
<p dir="auto">EPOLL on Linux can be a bit problematic when fork() is used (OSProcess forkSqueak). I wonder if there may also be some issues related to EPOLL on Linux pthreads? Totally guessing but Linux threads are built on top of its process model so it makes me wonder.</p>
<p dir="auto">Here are some updates I've made in the last year related to EPOLL on Linux when fork() may be involved:</p>
<p dir="auto">Author: David T Lewis <a href="mailto:dtlewis290@gmail.com">dtlewis290@gmail.com</a><br>
Date:   Fri Jul 23 18:47:02 2021 -0400<br>
Merge pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="803914151" data-permission-text="Title is private" data-url="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/552" data-hovercard-type="pull_request" data-hovercard-url="/OpenSmalltalk/opensmalltalk-vm/pull/552/hovercard" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/552">#552</a> from OpenSmalltalk/dtl/epoll-forksqueak<br>
For epoll aio, close and reopen the epoll fd in forked child process</p>
<p dir="auto">commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/066a43128584d55964f4a6ace4b2c878cf96087e/hovercard" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/066a43128584d55964f4a6ace4b2c878cf96087e"><tt>066a431</tt></a><br>
Author: David T. Lewis <a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a><br>
Date:   Mon Feb 8 15:14:42 2021 -0500<br>
For epoll aio, close and reopen the epoll fd in forked child process<br>
Factor the epoll initiation out of aioInit into new epollInit function<br>
and invoke it via pthread_atfork in the child process after a fork.<br>
Prevents misdelivery of events from the common kernel epoll structures.</p>
<p dir="auto">commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f376ffbc0b6d62047b7effb7f29d405fbd7e4611/hovercard" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f376ffbc0b6d62047b7effb7f29d405fbd7e4611"><tt>f376ffb</tt></a><br>
Author: David T. Lewis <a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a><br>
Date:   Sun Feb 7 23:16:24 2021 -0500<br>
Fix epoll event delivery error messages cut and paste error</p>
<p dir="auto">commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b6616b21d263ecaa334d458bf3a9579fcb88c635/hovercard" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b6616b21d263ecaa334d458bf3a9579fcb88c635"><tt>b6616b2</tt></a><br>
Author: David T. Lewis <a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a><br>
Date:   Sun Feb 7 12:12:42 2021 -0500<br>
Handle epoll event delivery errors without VM segfault.<br>
Under certain error conditions epoll may deliver event notification to the<br>
wrong process, with empty event data provided by the kernel. If this happens,<br>
handle the condition with a message to stderr and proceed without segfault.<br>
Error messages will look like this:</p>
<pre><code>  aioPoll in process 9055 no readHandler in epollEventData undefined handler called (fd 0, flags 2)
</code></pre>
<p dir="auto">commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/75498075b2bd030794f54c5303d00626fe33b195/hovercard" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/75498075b2bd030794f54c5303d00626fe33b195"><tt>7549807</tt></a><br>
Author: David T. Lewis <a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a><br>
Date:   Sun Feb 7 12:09:51 2021 -0500<br>
Rearrange forgetXDisplay to disable aio before fd close.<br>
Required for epoll event handling, we should not close the descriptor<br>
before unregistering it.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/615#issuecomment-1047282935">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AIJPEW6CVVF2AFJHZR2Q3Q3U4K77JANCNFSM5O7YHM7A">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AIJPEWYTF5EDY4RQDGZI4QDU4K77JA5CNFSM5O7YHM7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHZWEJ5Y.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><OpenSmalltalk/opensmalltalk-vm/issues/615/1047282935</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/615#issuecomment-1047282935",
"url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/615#issuecomment-1047282935",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>