Artifacts Associated With Ticket 18f4a94d03b075c6
Ticket change [527bfc89b5] (rid 194708) by bll on 2021-06-09 19:16:34:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I have some memory channel code that does: puts $sendchannel some-data ; # non-blocking gets $readchannel myvar ; # blocking, line buffered This no longer works on macos. the fileevent on the read handle is not triggered, and the gets returns an empty string. If I put an 'update idletasks' inbetween the puts/gets, it works. I have not been able to test on Linux or Windows as yet.
- foundin initialized to: "8.7a5rc0"
- is_private initialized to: "0"
- login: "bll"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "bll"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to:
8.7 : macos : a blocking memory channel no longer works.
- type initialized to: "Bug"
Ticket change [fd54840ac6] (rid 194720) by bll on 2021-06-10 12:30:19:
- comment changed to:
I have some memory channel code that does: puts $sendchannel some-data ; # non-blocking gets $readchannel myvar ; # blocking, line buffered This no longer works on macos. the fileevent on the read handle is not triggered, and the gets returns an empty string. If I put an 'update idletasks' inbetween the puts/gets, it works. I have not been able to test on Linux as yet. Edit 1: Changed subject, as this appears to be a problem on both macos and windows.
- login: "bll"
- mimetype: "text/plain"
- priority changed to: "7 High"
- title changed to: "8.7 : a blocking memory channel no longer works."
- comment changed to:
Ticket change [ee838118b0] (rid 194730) by bll on 2021-06-10 15:16:29:
- login: "bll"
- mimetype: "text/plain"
- severity changed to: "Important"
Ticket change [807ad9b838] (rid 194751) by bll on 2021-06-11 15:32:09:
- icomment:
Confirmed that this fails on MacOS, Windows and Linux.
- login: "bll"
- mimetype: "text/plain"
- icomment:
Add attachment "memsocktest.tcl" [e6a2a1a5d8] (rid 194755) by bll on 2021-06-12 08:46:09.
Ticket change [5570c998f5] (rid 194756) by bll on 2021-06-12 08:46:47:
- icomment:
Attached a non-minimal program that demonstrates the failure.
- login: "bll"
- mimetype: "text/plain"
- icomment:
Ticket change [c3d29a0d48] (rid 194777) by jan.nijtmans on 2021-06-15 12:46:17:
- assignee changed to: "pooryorick"
- icomment:
Thanks for the testcase! I did a bisect with the following result: <pre> 12 BAD 2019-04-24 04:52:22 [9bcec7cd880540c3] 13 GOOD 2019-04-23 06:50:02 [c4804bce46c2b672] </pre> Conclusion: This [67a5eabbd3d1|Bugfix] introduced the regression. Assigning to pouryorick for further analysis.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [546e9a354e] (rid 194783) by jan.nijtmans on 2021-06-15 13:00:25:
- icomment: "Proposed fix [3f466e55c8|here]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [d2820fb10f] (rid 194785) by jan.nijtmans on 2021-06-15 14:55:10:
- icomment: "Fixed [a785b5bf5e11645d|here]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [ff23819d4c] (rid 194788) by jan.nijtmans on 2021-06-15 15:02:16:
- closedate changed to: "2459381.12658161"
- closer changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [b9c8e0111c] (rid 194792) by pooryorick on 2021-06-16 10:30:32:
- closer changed to: "nobody"
- icomment:
The behaviour this report describes is not a bug. The provided test sets an event handler but then never enters the event loop: <code><verbatim> fileevent $ch readable [list ::memsock::readhandler $ch $port $handler] </verbatim></code> This behaviour is not supported. Ad event handler on a channel can not not be processed until the event loop is entered. The example may have worked in previous versions of Tcl, but only because of the bug described in [67a5eabbd3d19591] and [ef28eb1f1516|TCL_FILE_EVENTS cannot drive async I/O alone]. In the attached "memsock.test" example, "sendget" relies on this event handler noted above to ferry data between the sending channel and the receiving channel. This is an error. That handler should not be activated until the event loop is entered. This "memsock.test" example attached to this report is in essence a restatment of [67a5eabbd3d19591|refchan, coroutine, and postevent from the "watch" proc], and that issue was already fixed. Unfortunately, in response to this new issue, that fix was reverted, effectively unfixing issue [67a5eabbd3d19591], and therefore unfixing the real bug illustreated by "memsock.test". The work that was reverted represents an important change in the direction of correcting some fundamental issues in Tcl's IO subsystem. That work should be reinstated immediately so that it makes it into the 8.7 release. There may indeed be an outstanding issue regarding writing to a nonblocking channel and then attempting to immediately read from it, but such an issue can be fixed far more gracefully than by making the revert in question.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Open"
Ticket change [3ea0412c80] (rid 194793) by pooryorick on 2021-06-16 10:34:03:
- icomment:
Also, no test case was developed for this report, indicating that an expedient resolution was undertaken rather than a correct one.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [1961f953a9] (rid 194794) by jan.nijtmans on 2021-06-16 10:50:28:
- icomment:
> There may indeed be an outstanding issue regarding writing to a nonblocking > channel and then attempting to immediately read from it, but such an issue can > be fixed far more gracefully than by making the revert in question. Fully agreed. So, I suggest to fix this outstanding issue, and then put it in again. Another remark: If this is a bug, it should have been applied to Tcl 8.6 as well. Why wasn't that done at the time? Then this outstanding issue would have been discovered much earlier. For now (just before Tcl 8.7a5) I agree with reverting this. But - as soon as it is corrected - it should be re-applied, but then to both 8.6 and 8.7
- login: "jan.nijtmans"
- mimetype: "text/plain"
- icomment:
Ticket change [c61274abe3] (rid 194795) by pooryorick on 2021-06-16 11:26:29:
- icomment:
Thank you! No bug has yet been demonstrated, but I'm working now on a new test case. Perhaps it will expose something. I used to port more things back to 8.6, but got pushback about making unnecessary changes to a patch release. I no longer want to invest my time in the 8.6 series, but instead focus on 8.7 and above. Other people who care more about 8.6 can port fixes if they consider it worth their time.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment:
Add attachment "memsock_vwait.test" [88476b4c3e] (rid 194797) by pooryorick on 2021-06-16 12:07:34.
Ticket change [f8314f905b] (rid 194798) by pooryorick on 2021-06-16 12:11:45:
- icomment:
As was indicated by the original description of resolving the issue using [update idletasks], what's needed is some event processing between the write to one channel and the read from the other. The attached file, memsock_vwait.test, accomplishes that by entering an event loop at the top level, scheduling a main coroutine to be run by that event loop, and then yielding the coroutine at the key moment to allow some event processing.
- login: "pooryorick"
- mimetype: "text/plain"
- icomment:
Ticket change [1921f3537b] (rid 194799) by pooryorick on 2021-06-16 12:13:21:
- icomment:
An attempt to reproduce any sort of bug based on the provided description and attached "memsock.test" was fruitless. This ticket can be closed as invalid.
- login: "pooryorick"
- mimetype: "text/plain"
- icomment:
Ticket change [9bae2779a6] (rid 194901) by pooryorick on 2021-06-19 21:53:38:
- closedate changed to: "2459385.41225105"
- closer changed to: "pooryorick"
- login: "pooryorick"
- mimetype: "text/plain"
- status changed to: "Closed"
Ticket change [f683832177] (rid 230069) by jan.nijtmans on 2024-08-13 19:26:15:
- closedate changed to: "2460536.30990374"
- closer changed to: "jan.nijtmans"
- icomment: "Fixed - finally - by reverting [9bcec7cd880540c3]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
Ticket change [d61c2ccfb0] (rid 230332) by pooryorick on 2024-08-18 20:07:06:
- closedate changed to: "2460541.33827218"
- closer changed to: "pooryorick"
- icomment:
Even if example script happens to work now, this report is still invalid. As the documentation states, for non-blocking mode to work correctly, the application must be using the Tcl event loop.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
Ticket change [280aabd0f7] (rid 230333) by jan.nijtmans on 2024-08-18 20:24:14:
- closedate changed to: "2460541.35016666"
- closer changed to: "jan.nijtmans"
- icomment:
Setting the "Resolution" field of this ticket to "Invalid" doesn't make this Bug report invalid. @bll, I value this report, I'm glad it's "Fixed".
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [49ddc26fa0] (rid 230361) by pooryorick on 2024-08-19 14:03:41:
- closedate changed to: "2460542.08589841"
- closer changed to: "pooryorick"
- icomment:
That's fine as long as people don't expect it to stay "fixed".
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"