Mantis - Squeak
Viewing Issue Advanced Details
5245 Kernel major random 10-16-06 13:33 10-17-06 12:45
mikevdg  
mikevdg  
normal  
closed 3.8  
fixed  
none    
none 3.9  
0005245: Delay class>>primitiveFailed
Any help in diagnosing the problem is appreciated.

At random occasions after running my code, I get the above error. The image freezes, consumes 100% CPU and cannot be interupted with ALT-.

The stack trace is in the attached screenshot.

I have seen this error on Linux and Windows in multiple VM versions. Currently I am using:

mikevdg@neb:~/dpon$ ./squeak -version
3.9-7 #1 Tue Jul 4 11:12:22 NZST 2006 gcc 4.0.2
Squeak3.9alpha of 4 July 2005 [latest update: 0007021]
Linux neb 2.6.12-9-386 #1 Mon Oct 10 13:14:36 BST 2005 i686 GNU/Linux
default plugin location: /home/mikevdg/squeak/vmmaker//lib/squeak/3.9-7/*.so
related to 0001840closed ducasse Long Delays and multiple delays with same resumption time 
 Delay_primfailed.png [^] (80,505 bytes) 10-16-06 13:33
 SqueakDebug.log [^] (3,160 bytes) 10-16-06 13:36

Notes
(0007699)
mikevdg   
10-16-06 13:49   
Reading through the VM source code (and using some guesswork), it appears that I'm not passing an integer to this primitive. Yet the attached SqueakDebug.log shows that I am passing a SmallInteger.
(0007701)
tim   
10-16-06 19:29   
Um, look at the delay value.

Delay class>>primSignal:atMilliseconds:
    Receiver: Delay
    Arguments and temporary variables:
        aSemaphore: a Semaphore()
        aSmallInteger: 3321559286

That's not a SmallInteger. It's not a VM bug, it's a problem with worling out the resumption time properly.
(0007702)
mikevdg   
10-17-06 02:48   
Thanks, Tim! I forgot that SmallIntegers only go up to 2^31 (which is 2147483648) rather than 2^32.

There are now two issues here:
1. Make that number is a SmallInteger.
2. Get Squeak to gracefully handle this case rather than freezing up.

I'll have a crack at it tonight.
(0007704)
tim   
10-17-06 04:04   
See 0001840 and note that the fix was in 3.9-7026. Your crash claims to have been in 39.-7021 - so check the latest version and see if it solves your problem.
(0007709)
mikevdg   
10-17-06 12:39   
Ha! I added an assertion to make sure that Delays weren't being made with anything but SmallIntegers. I caught the following:

Delay(Object)>>assert:
Delay>>setDelay:forSemaphore:
Delay class>>timeoutSemaphore:afterMSecs:
Semaphore>>waitTimeoutMSecs:
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Socket>>waitForConnectionFor:ifTimedOut:
Socket>>waitForConnectionFor:
[] in VatManager>>loopOnPort: {[[running] whileTrue: [socket := Socket newTCP listenOn: port. socket w...]}
[] in BlockContext>>newProcess {[self value. Processor terminateActive]}

My own code is the culprit:

socket waitForConnectionFor: (Socket standardDeadline).

Here, (Socket standardDeadline) returns a millisecond value. waitForConnectionFor: takes a number of seconds as an argument. Heh.

It would be nice if the Delay class would check its arguments to make sure the primitive doesn't fail.
(0007710)
mikevdg   
10-17-06 12:45   
Appears to be fixed by Tim's changes in bug 1840. Changes already in Squeak 3.9-7026.