medley icon indicating copy to clipboard operation
medley copied to clipboard

Attempt to decrement 0 reference count error when drawing thousands of pixels to Sketch stream

Open pamoroso opened this issue 7 months ago • 2 comments

Describe the bug

Using DRAWPOINT to draw several thousand pixels to a Sketch stream crashes Medley and enters URaid with the error:

*Error* attempt to decrement 0 reference count
Enter the URaid
CL:NIL

To Reproduce

Steps to reproduce the behavior:

  1. launch Medley
  2. at an Interlisp Exec evaluate (FILESLOAD SKETCH SKETCH-STREAM)
  3. at an Interlisp Exec evaluate (SETQ S (OPENIMAGESTREAM 'TEST 'SKETCH))
  4. at an Interlisp Exec evaluate (FOR X FROM 0 TO 639 DO (FOR Y FROM 0 TO 479 DO (DRAWPOINT X Y NIL S)))

Expected behavior

The drawing operations to the Sketch stream complete with no errors.

Screenshots

The Medley session when URaid is entered:

Image

Context (please complete the following information):

  • Are you using online.interlisp.org? no
  • OS: Linux
  • OS Version: Mint 22.1 Cinnamon
  • Display/window system: X11
  • Host arch: x86_64 (System76 Merkaat)
  • Maiko version: 4994982
  • IL:MAKESYSDATE: 26-May-2025 12:50:11 (Maiko: master; Medley: master)

Additional context

I'm not sure whether this a bug or an expected consequence of the overhead of performing so many graphical operations on a Sketch stream.

pamoroso avatar May 27 '25 18:05 pamoroso

I got a similar error running a loadup / do_hcfiles script. I haven't tracked down the situation. The error happened running with open PR's merged, but I didn't try it in just 'master'.

masinter avatar May 27 '25 19:05 masinter

I was able to reproduce this with master (38f41790). HOWEVER, I noticed a some oddities in the URaid frame dump: Although this was executed in the Interlisp Exec (in the Interlisp package), all symbols have a package prefix (not that big a deal). Some symbols displayed have package prefixes that don't make sense: CL:NIL (is this actually natively defined in the CL: package?) CL:ROUND for the BRUSH shape, not IL: ?

Also, I kept walking up the stack frames and then URaid, itself, errored:

< w
 At IL:\MAIKO.DORECLAIM
   PC cnt = 030

< l
  0 :    0x14360 : IL:\MAIKO.DORECLAIM
  1 :    0x1434c : IL:SK.WIRE.CREATE
  2 :    0x14320 : IL:WIRE.INPUTFN
  3 :    0x142fa : IL:\DRAWLINE.SKETCH
  4 :    0x142d2 : IL:DRAWLINE
  5 :    0x142ac : IL:\DRAWPOINT.GENERIC
  6 :    0x1428c : IL:DRAWPOINT
  7 :    0x14262 : IL:\EVALFORM
  8 :    0x14232 : IL:\PROG0
  9 :    0x141e8 : CL:PROG
 10 :    0x141c8 : IL:\EVALFORM
 11 :    0x14198 : IL:\PROG0
 12 :    0x1414e : CL:PROG
 13 :    0x1412e : IL:\EVALFORM
 14 :    0x14110 : IL:FAULTEVAL
 15 :    0x140f2 : IL:\EVALFORM
 16 :    0x140de : IL:EVAL
 17 :    0x140ba : IL:EVAL-INPUT
 18 :    0x14048 : IL:DO-EVENT
 19 :    0x14012 : XCL:EXECA0001A0002
 20 :    0x13fda : XCL:EXECA0001
 21 :    0x13f34 : IL:\DO.PROGV
 22 :    0x13eb6 : XCL:EXEC
 23 :    0x13e8a : IL:\EVALFORM
 24 :    0x13e70 : CL:PROGN
 25 :    0x13e50 : IL:\EVALFORM
 26 :    0x13e02 : IL:\MAKE.PROCESS0
 27 :    0x11802 : CL:T

< f 1
IVAR -------
  1433c : 0x 1dc  0x7146  IL:KNOTS  ((67 . 40) (67 . 40))
  1433e : 0x 1dc  0x713c  IL:BRUSH  (CL:ROUND 1.000000 CL:NIL)
  14340 : 0x   0  0x   0  IL:DASHING  CL:NIL
  14342 : 0x   0  0x   0  IL:CLOSED  CL:NIL
  14344 : 0x   e  0x   1  IL:SCALE  1
  14346 : 0x   0  0x   0  IL:ARROWHEADS  CL:NIL
  14348 : 0x   0  0x   0  IL:FILLING  CL:NIL

## STACK BF at 0x1434a ##
[cnt=0 ]
ivar : 0x433c
>> Bf's ivar says 0x1433c vs. IVar says 0x1435e
Fname is IL:SK.WIRE.CREATE
## STACK FX at 0x1434c ##
[cnt = 0 ]
 #alink           0x432a
 fnhead   0x5e3854
 nextblock        0x435e
 pc               0x5b
 nametbl  0xc000434a
 #blink           0x0
 #clink           0x0
  14356 : 0x  5b  0x2a3e
  14358 : 0x   0  0x   0
  1435a : 0x 1dc  0x7138
  1435c : 0x   0  0x   0

< f 2
IVAR -------
  14310 : 0x  5a  0x353c  IL:W  {IL:WINDOW}0x5a353c
  14312 : 0x 1dc  0x7146  IL:GPTLIST  ((67 . 40) (67 . 40))
  14314 : 0x   0  0x   0  IL:CLOSEDFLG  CL:NIL
  14316 : 0x  5f  0x5f00  IL:BRUSH  1.000000
  14318 : 0x   e  0x   1  IL:DEFSCALE  1
  1431a : 0x   0  0x   0  IL:DASHING  CL:NIL
  1431c : 0x   0  0x   0  IL:FILLING  CL:NIL

## STACK BF at 0x1431e ##
[cnt=0 ]
ivar : 0x4310
>> Bf's ivar says 0x14310 vs. IVar says 0x1435e
Fname is IL:WIRE.INPUTFN
## STACK FX at 0x14320 ##
[cnt = 0 ]
 #alink           0x4304
 fnhead   0x5e2980
 nextblock        0x433c
 pc               0xe7
 nametbl  0x5b2a3e
 #blink           0xffff
 #clink           0xffff
  1432a : 0x  5b  0x2a3e  IL:SKCONTEXT  ((CL:ROUND 1 IL:BLACK) (IL:GACHA 10 (* * *)) (IL:LEFT IL:BASELINE) (IL:CURVE 18.000000 8) CL:NIL CL:NIL (IL:CENTER IL:CENTER) (CL:NIL CL:NIL CL:NIL) CL:T CL:NIL CL:NIL )
  1432c : 0x 1dc  0x7146  IL:KNOTS  ((67 . 40) (67 . 40))
  1432e : 0xffff  0xffff  *local* [pvar2]   [variable not bound]
  14330 : 0xffff  0xffff  *local* [pvar3]   [variable not bound]
  14332 : 0xffff  0xffff  *local* [pvar4]   [variable not bound]
  14334 : 0xffff  0xffff  IL:PT  [variable not bound]
  14336 : 0x  6f  0x5950
  14338 : 0x   0  0x   0
Press Return(to quit Esc and Ret):
  1433a : 0xfffd  0x   2

< f 3
IVAR -------
  142e6 : 0x  5d  0x3880  IL:SKETCHSTREAM  {CL:STREAM}0x5d3880
  142e8 : 0x   e  0x  43  IL:X1  67
  142ea : 0x   e  0x  28  IL:Y1  40
  142ec : 0x   e  0x  43  IL:X2  67
  142ee : 0x   e  0x  28  IL:Y2  40
  142f0 : 0x  5f  0x5f00  IL:WIDTH  1.000000
  142f2 : 0x   0  0x   0  IL:OPERATION  CL:NIL
  142f4 : 0x   0  0x   0  IL:COLOR  CL:NIL
  142f6 : 0x   0  0x   0  IL:DASHING  CL:NIL

## STACK BF at 0x142f8 ##
[cnt=0 ]
ivar : 0x42e6
>> Bf's ivar says 0x142e6 vs. IVar says 0x1435e
Fname is IL:\DRAWLINE.SKETCH
## STACK FX at 0x142fa ##
[cnt = 0 ]
 #alink           0x42dc
 fnhead   0x5a2fa8
 nextblock        0x4310
 pc               0x9c
 nametbl  0x0
 #blink           0x5d
 #clink           0x3880
  14304 : 0x  5a  0x353c  IL:SKW  {IL:WINDOW}0x5a353c
  14306 : 0xffff  0xffff
  14308 : 0x8000  0x4302
  1430a : 0x   0  0x   0
  1430c : 0xfffe  0x   0
  1430e : 0x   0  0x   0
Press Return(to quit Esc and Ret):

< f 4
IVAR -------
  142be : 0x   e  0x  43  IL:X1  67
  142c0 : 0x   e  0x  28  IL:Y1  40
  142c2 : 0x   e  0x  43  IL:X2  67
  142c4 : 0x   e  0x  28  IL:Y2  40
  142c6 : 0x  5f  0x5f00  IL:WIDTH  1.000000
  142c8 : 0x   0  0x   0  IL:OPERATION  CL:NIL
  142ca : 0x  5d  0x3880  CL:STREAM  {CL:STREAM}0x5d3880
  142cc : 0x   0  0x   0  IL:COLOR  CL:NIL
  142ce : 0x   0  0x   0  IL:DASHING  CL:NIL

## STACK BF at 0x142d0 ##
[cnt=0 ]
ivar : 0x42be
>> Bf's ivar says 0x142be vs. IVar says 0x1435e
Fname is IL:DRAWLINE
## STACK FX at 0x142d2 ##
[cnt = 0 ]
 #alink           0x42b6
 fnhead   0x2eb710
 nextblock        0x42e6
 pc               0x9e
 nametbl  0x5a3186
 #blink           0xffff
 #clink           0xffff
  142dc : 0x  5a  0x314a  IL:A0063  IL:\DRAWLINE.SKETCH
  142de : 0xffff  0xffff
  142e0 : 0xfffe  0x   0
  142e2 : 0x   0  0x   0
  142e4 : 0xfffe  0x   0

<
IVAR -------
  142a0 : 0x  5d  0x3880  CL:STREAM  {CL:STREAM}0x5d3880
  142a2 : 0x   e  0x  43  IL:X  67
  142a4 : 0x   e  0x  28  IL:Y  40
  142a6 : 0x 1dc  0x714c  IL:BRUSH  (CL:ROUND 1.000000 CL:NIL)
  142a8 : 0x   0  0x   0  IL:OPERATION  CL:NIL

## STACK BF at 0x142aa ##
[cnt=0 ]
ivar : 0x42a0
>> Bf's ivar says 0x142a0 vs. IVar says 0x1435e
Fname is IL:\DRAWPOINT.GENERIC
## STACK FX at 0x142ac ##
[cnt = 0 ]
 #alink           0x4296
 fnhead   0x2eba6c
 nextblock        0x42be
 pc               0x53
 nametbl  0x42c800a0
 #blink           0xffff
 #clink           0xffff
  142b6 : 0xffff  0xffff
  142b8 : 0xffff  0xffff
  142ba : 0xffff  0xffff
  142bc : 0x   0  0x   0

<
IVAR -------
  14280 : 0x   e  0x  43  IL:X  67
  14282 : 0x   e  0x  28  IL:Y  40
  14284 : 0x   0  0x   0  IL:BRUSH  CL:NIL
  14286 : 0x  5d  0x3880  CL:STREAM  {CL:STREAM}0x5d3880
  14288 : 0x   0  0x   0  IL:OPERATION  CL:NIL

## STACK BF at 0x1428a ##
[cnt=0 ]
ivar : 0x4280
>> Bf's ivar says 0x14280 vs. IVar says 0x1435e
Fname is IL:DRAWPOINT
## STACK FX at 0x1428c ##
[cnt = 0 ]
 #alink           0x426c
 fnhead   0x2eb7ac
 nextblock        0x42a0
 pc               0x88
 nametbl  0x5ab56c
 #blink           0xfffd
 #clink           0x2
  14296 : 0x   0  0x 724  IL:A0065  IL:\DRAWPOINT.GENERIC
  14298 : 0xffff  0xffff
  1429a : 0x8000  0x4296
  1429c : 0x  5d  0x3880
  1429e : 0xfffe  0x   0

<
IVAR -------
  1425c : 0x  5a  0x7098  IL:*FORM*  (IL:DRAWPOINT IL:X IL:Y CL:NIL IL:S)

*Error* Segmentation fault at address 0x78363617f04f.
Please record the signal and code information
and do a 'v' before trying anything else.
Enter the URaid
  1425e : 0x   0  0x 701  CL:NIL

<

MattHeffron avatar Jun 09 '25 19:06 MattHeffron