<div dir="ltr">Hi Levente,<div><br></div><div> the first thing to report is that this isn't a Cog-specific bug. It also reproduces using the trunk VM sources (4.15.3) and a freshly built linux VM with a 4.6 image.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 2:16 AM, Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Eliot,<br>
<br>
The snippet below, evaluated from a workspace, triggered the issue in less than a minute for me, three times in a row.<br>
Both processes will halt if #sloppyWaitForDataIfClosed: doesn't return within a second. If you send #dataAvailable to the socket, you'll find that it has data ready to be read, but its readSemaphore has no signal.<br>
<br>
Levente<br>
<br>
<br>
Socket compile: 'sloppyWaitForDataIfClosed: closedBlock<br>
<br>
[(socketHandle ~~ nil<br>
and: [self primSocketReceiveDataAvailable: socketHandle]) ifTrue:<span class=""><br>
[^self].<br>
self isConnected ifFalse:<br>
[^closedBlock value].<br></span>
self readSemaphore wait] repeat'<br>
classified: 'waiting'.<br>
<br>
[<br>
listenerSocket := Socket newTCP.<br>
listenerSocket listenOn: 0 backlogSize: 4 interface: #[127 0 0 1].<br>
clientSocket := Socket newTCP.<br>
clientSocket connectTo: #[127 0 0 1] port: listenerSocket localPort.<br>
clientSocket waitForConnectionFor: 1.<br>
self assert: clientSocket isConnected.<br>
serverSocket := listenerSocket waitForAcceptFor: 1.<br>
self assert: serverSocket isConnected ]<br>
ensure: [ listenerSocket destroy ].<br>
<br>
serverProcess := [<br>
| shouldRun buffer bytesReceived waitDuration |<br>
shouldRun := true.<br>
buffer := ByteString new: 10.<br>
waitDuration := 1 second.<br>
[<br>
[ serverSocket sloppyWaitForDataIfClosed: [ shouldRun := false ] ]<br>
valueWithin: waitDuration<br>
onTimeout: [ self halt ].<br>
buffer atAllPut: (Character value: 0).<br>
bytesReceived := serverSocket receiveDataInto: buffer.<br>
self assert: bytesReceived = 4.<br>
self assert: (buffer first: 4) = 'PING'.<br>
serverSocket sendData: 'PONG' ] repeat ] newProcess.<br>
clientProcess := [<br>
| shouldRun buffer bytesReceived waitDuration |<br>
shouldRun := true.<br>
buffer := ByteString new: 10.<br>
waitDuration := 1 second.<br>
[<br>
clientSocket sendData: 'PING'.<br>
[ clientSocket sloppyWaitForDataIfClosed: [ shouldRun := false ] ]<br>
valueWithin: waitDuration<br>
onTimeout: [ self halt ].<br>
buffer atAllPut: (Character value: 0).<br>
bytesReceived := clientSocket receiveDataInto: buffer.<br>
self assert: bytesReceived = 4.<br>
self assert: (buffer first: 4) = 'PONG' ] repeat ] newProcess.<br>
clientProcess priority: 39; resume.<br>
serverProcess priority: 39; resume.<br>
<br>
"Evaluate these after debugging:<br>
clientSocket destroy.<br>
serverSocket destroy."<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Wed, 23 Mar 2016, Eliot Miranda wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Levente,<br>
On Wed, Mar 23, 2016 at 11:31 AM, Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>> wrote:<br>
Hi Eliot,<br>
<br>
What sort of reproducibility are you looking for? Is it enough if it happens once every few hours or do you need something that you can trigger on demand?<br>
<br>
<br>
I'll take every few hours, but I'd prefer "in under 30 minutes". Getting warm and fuzzy feelings when trying to prove a negative with something that takes hours to run is very difficult. Let's say you have<br>
a case which reproduces in 8 hours 50% of the time. To reach 99% confidence level in a fix I'd have to run it for 8 * (50 log: 2) hours without seeing it reproduce, right? That's nearly 2 days; it could<br>
take weeks to fix :-(<br>
<br>
Levente<br>
<br>
<br>
<br>
_,,,^..^,,,_<br>
best, Eliot<br>
<br>
</blockquote>
</div></div><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div>