-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Original bug ID: 5325
Reporter: @dra27
Status: closed (set by @xavierleroy on 2017-02-16T14:18:20Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.12.0
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Has duplicate: #6771
Related to: #4466 #5327 #5578
Monitored by: @protz
Bug description
It appears not be possible to write to a socket in one thread if another thread is blocked in a [recv] call on the same socket (and presumably vice versa).
This behaviour only seems to affect Windows - tried on both Windows 7 with 3.12.0 and Windows XP with 3.10.1 with the same effect.
Additional information
The attached file should be compiled with ocamlopt -o foo.exe -thread unix.cmxa threads.cmxa Foo.ml
It can then be invoked with, say:
foo www.google.com
and the line
GET / HTTP/1.0
followed by enter twice. On Linux, you'll see an HTTP redirect response. On Windows, the program will hang after the first carriage return eventually crashing with an exception when Google (or whoever) closes the socket at the other end on a timeout.
The equivalent code in C definitely works, so it appears to be a problem with Unix module / OCaml runtime.