|
2016-04-16
| ||
| 07:02 | • Closed ticket [c6b86cbfe4]: non-blocking IO write truncation plus 5 other changes artifact: 652a7c0467 user: ferrieux | |
| 07:02 | • Ticket [c6b86cbfe4]: 3 changes artifact: f865611309 user: ferrieux | |
|
2016-04-15
| ||
| 16:49 | • New ticket [c6b86cbfe4]. artifact: 1025566ebd user: pokute | |
| Ticket UUID: | c6b86cbfe4a1e14017a933f60afb33a4b980e2d5 | |||
| Title: | non-blocking IO write truncation | |||
| Type: | Bug | Version: | 8.6 (Debian Jessie) | |
| Submitter: | pokute | Created on: | 2016-04-15 16:49:51 | |
| Subsystem: | 16. Commands A-H | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2016-04-16 07:02:40 | |
| Resolution: | Invalid | Closed By: | ferrieux | |
| Closed on: | 2016-04-16 07:02:40 | |||
| Description: |
I have been sending mail through exim using a non-blocking Tcl pipe for many years. After upgrading to Debian Jessie, the mail is truncated.
The code that now fails to send the full stream (truncates to 64k) after working for many years:
set pipe [ open "|$sendmail -oi -t" a+ ]
fconfigure $pipe -blocking off
fconfigure $pipe -buffering line
puts $pipe $mail
::close $pipe
Turning blocking on fixes the truncation issue. I'm not saying that the current behavior is wrong, just that it is changed.
| |||
| User Comments: |
ferrieux added on 2016-04-16 07:02:09:
Since TIP#398 (accepted and committed on 2012-04-28), nonblocking channels are no longer forced back to blocking when closing or exiting. This was needed to avoid blocking indefinitely on a possibly frozen peer. It appears that your code depended on the previous behavior. That's what is expected when tagging an evolution *POTENTIAL INCOMPATIBILITY*, which is the case of TIP#398. The reason why it hit you on an OS upgrade rather than a Tcl upgrade, I guess, is a random change of the exact buffer sizes involved (size of $mail, or size of kernel pipe buffers driving the maximal single-write). The "fix" (or rather, improvement of your code) is trivial and works on all Tcl versions: when you want to return to blocking semantics, just say so :) I guess your snippet is a synthetic one tailored to highlight the behavior (no one in his right mind would do that otherwise ;-), but the idea is to simply [fconfigure $pipe -blocking on] before closing. | |||