Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2014-06-03
17:47 • Closed ticket [734138ded8]: close does not report error which was saved by a fai... artifact: 4143bb7575 user: dgp
17:47
[734138ded8] Revisions so that unreported errors don't get lost during the close of a channel. check-in: 4ea8a01012 user: dgp tags: trunk
12:44 • Ticket [734138ded8] close does not report error which was saved by a failing bac... artifact: 56118b8202 user: dgp
2014-06-02
07:47 • Ticket [734138ded8]: 4 changes artifact: 9d32f0f882 user: oehhar
2014-06-01
20:00 • Ticket [734138ded8]: 4 changes artifact: 3684d81b4e user: oehhar
2014-05-31
14:13 • Ticket [734138ded8]: 3 changes artifact: 1eadbc6554 user: dgp
13:55 • Ticket [734138ded8]: 3 changes artifact: 1ef6d7eea0 user: dgp
2014-05-30
19:14 • Ticket [734138ded8]: 4 changes artifact: 67e38698e8 user: oehhar
15:26 • Ticket [734138ded8]: 3 changes artifact: d62ca48e6e user: dgp
15:23 • Ticket [734138ded8]: 3 changes artifact: 69df83f8f8 user: dgp
13:44 • Ticket [734138ded8]: 3 changes artifact: 8ccf0f491f user: oehhar
13:43 • New ticket [734138ded8]. artifact: 282c1a24d4 user: oehhar

close does not report error which was saved by a failing background flush (socket-14.11.1)

Closed / Fixed734138ded8cca1906d920b837ec1cfd4bc811282Created 13 years agoUpdated 13 years ago
Descriptionwiki2014-05-30 13:43:53

Symptom

Test socket-14.11.1 fails on Windows and on Linux with a localhost resolving to ::1 and 127.0.0.1

Issue

When a background flush (for example invoked by a reported writable fileevent) fails, the error code is saved. If this socket is closed, the error should show up.

Demo

Correct behaviour

Version [9b3b3adf47] (before commit of [bug-13d3af3ad5]) showed the IMHO correct behaviour.

Here is a log in a windows tclsh:

% set h [socket -async localhost 30001]
sock01AC6220
% fconfigure $h -blocking 0
% puts $h Hi
% flush $h
% fileevent $h writable {set ::x 1}
% vwait x
% close $h
socket is not connected
%

What happens:

  • in the first row, a socket connect on an unopened port is started (which would take on a syncroneous connect up to 10 seconds on windows to report "connection refused" so the following commands are executed while connectiong).
  • then it is set to non-blocking and a write is issued.
  • The drivers send routine is called and returns with "EWOULDBLOCK"
  • fileevent and vwait wait until the connect fails. The fileevent reporting of the driver invokes, that the tclIO will call send on the driver which will report "socket is not connected" posix error code. This is stored by tclIO
  • close is executed. The socket is correctly closed and the stored error is shown to the user.

Trunk behaviour

With the current trunk, one gets:

% set h [socket -async localhost 30001]
sock01A26150
% fconfigure $h -blocking 0
% puts $h Hi
% flush $h
% fileevent $h writable {set ::x 1}
% vwait x
% close $h
%

So, the error does not show up.

Referenced by1
  • 4ea8a01012[734138ded8] Revisions so that unreported errors don't get lost during the close of a channel. check-in2014-06-03 17:47:23
oehhar Ticket [734138ded8]: 3 changes [History diff]2014-05-30 13:44:27
dgpplain2014-05-30 15:23:08
It would be most helpful if the demo of the issue
can be made into a portable test we can put in
the test suite to track progress fixing and not
re-breaking the issue.
dgpplain2014-05-30 15:26:41
Either post it here, or commit to the bug-13d3af3ad5 branch.
oehharwiki2014-05-30 19:14:08

The upper mentioned test "socket-14.11.1" is portable and shows the issue on Windows and Unix.

The only condition for Unix is, that localhost must resolve to ::1 and 127.0.0.1 which is normally the case.

Nevertheless this is not the case for (my) CentOS where etc/hosts is:

127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

The "6"s should not be there which breaks the test for my CentOS. Reinhard already creates a test condition for that and forgot to apply it to all relevant tests. He may do that soon.

dgpplain2014-05-31 13:55:54
The test failure socket-14.11.1 appears rooted
in the checkin

http://core.tcl.tk/tcl/info/84f992ce503821fd94f25acc28186e53a586afa4
dgpplain2014-05-31 14:13:33
see new branch bug-734138ded8
oehharwiki2014-06-01 20:00:24

Unfortunately, the branch does not build for me. The error is:

        cl -nologo -c -W3 -DUNICODE -D_UNICODE -QI0f -W3 -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -Fp.\Release\tcl_ThreadedDynamic\ -O2  -Ot -Oi -Op -Gs -YX -MD -I"C:\test\tcl-bug-13d3af3ad5_ipv6_win\win\..\win" -I"C:\test\tcl-bug-13d3af3ad5_ipv6_win\win\..\generic" -I"C:\test\tcl-bug-13d3af3ad5_ipv6_win\win\..\libtommath" -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -DTCL_CFGVAL_ENCODING=\"cp1252\" -DSTDC_HEADERS -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -DNDEBUG -DTCL_CFG_OPTIMIZED -DNO_STRTOI64 -DBUILD_tcl -Fo.\Release\tcl_ThreadedDynamic\ @C:\Users\oehhar\AppData\Local\Temp\nm45B7.tmp
tclStubInit.c
C:\test\tcl-bug-13d3af3ad5_ipv6_win\win\..\generic\tclStubInit.c(596) : error C2152: 'initializing' : pointers to functions with different attributes
C:\test\tcl-bug-13d3af3ad5_ipv6_win\win\..\generic\tclStubInit.c(597) : error C2152: 'initializing' : pointers to functions with different attributes
C:\test\tcl-bug-13d3af3ad5_ipv6_win\win\..\generic\tclStubInit.c(601) : error C2152: 'initializing' : pointers to functions with different attributes
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

Perhaps, I may retry tomorrow with more time.

oehharwiki2014-06-02 07:47:00

Branch [bug-734138ded8] checkin [5f5b6fc4b2]: Test on Win Vista 32 bit with ms-vc6:

  • Manual test descriped above ok
  • All socket tests ok
  • chan-io-1.9 fails

I don't know what was wrong yesterday, now it compiles very well.

Sorry, Harald

dgpplain2014-06-03 12:44:30
see branch dgp-async-socket for another attempt.
dgp Closed ticket [734138ded8]. [History diff]2014-06-03 17:47:51
Log in (anonymous is fine) to add a comment.