Lisp HUG Maillist Archive

Crashing and Hanging LispWorks after adding sound to application

Hello,

I’m working on a little typing game and when I added sound to the mix, LispWorks will consistently hang with this program.  More specifically, it seems that it starts crashing reliably once I added a call to stop-sound before my next call to play-sound in typing-handle-character.  

Source attached in typing.lisp which should run without any other dependencies.  Just run and start typing the words as they come across the screen, after less than 10 words usually it should either popup and error about a segmentation violation or hang the system and just stop working.

Hopefully this test program can help with improving the stability of LispWorks.

—
Burton Samograd


Re: Crashing and Hanging LispWorks after adding sound to application

Hi,

it crashes already without using the sounds after some typing. Mac, Lispworks 64bit, macOS Sierra.

I haven't looked closely, but I fear how you use threads and timers may not work.
Remember that the Mac wants things (drawing, ....) to happen in the main thread.
Just guessing.

The function FILTER is called REMOVE in Common Lisp. It does the same.

Also you have an unhealthy mix of global variables and closed over lexical variables. These variables are relevant for the pane.
I would recommend:

a) subclass the pane class and add the appropriate slots. Access the data via the pane objects slots.

or

b) capi-objects have property lists. An output-pane has a superclass capi-object. see capi:capi-object-property to get/set those.

Generally I would recommend a).

Regards,

Rainer

Am 03.01.2017 um 12:38 schrieb BusFactor1 <busfactor1@gmail.com>:

Hello,

I’m working on a little typing game and when I added sound to the mix, LispWorks will consistently hang with this program.  More specifically, it seems that it starts crashing reliably once I added a call to stop-sound before my next call to play-sound in typing-handle-character.  

Source attached in typing.lisp which should run without any other dependencies.  Just run and start typing the words as they come across the screen, after less than 10 words usually it should either popup and error about a segmentation violation or hang the system and just stop working.

Hopefully this test program can help with improving the stability of LispWorks.

—
Burton Samograd


<typing.lisp><typewriter.wav>

Re: Crashing and Hanging LispWorks after adding sound to application

Hi,

see also:

4.1  The correct thread for CAPI operations
http://www.lispworks.com/documentation/lw70/CAPI-M/html/capi-m-27.htm#pgfId-892155

Regards,

Rainer Joswig


Am 03.01.2017 um 14:20 schrieb Alexey Veretennikov <txm.fourier@gmail.com>:

Hi,

Does not crash for me on Windows LW6.1 Personal.
Regarding timers and UI, read carefully the following section:
http://www.lispworks.com/documentation/lw70/LW/html/lw-142.htm#pgfId-890017

I also agree with Rainer on subclassing.


Br,
/Alexey

On Tue, Jan 3, 2017 at 1:52 PM, Rainer Joswig <joswig@lisp.de> wrote:
Hi,

it crashes already without using the sounds after some typing. Mac, Lispworks 64bit, macOS Sierra.

I haven't looked closely, but I fear how you use threads and timers may not work.
Remember that the Mac wants things (drawing, ....) to happen in the main thread.
Just guessing.

The function FILTER is called REMOVE in Common Lisp. It does the same.

Also you have an unhealthy mix of global variables and closed over lexical variables. These variables are relevant for the pane.
I would recommend:

a) subclass the pane class and add the appropriate slots. Access the data via the pane objects slots.

or

b) capi-objects have property lists. An output-pane has a superclass capi-object. see capi:capi-object-property to get/set those.

Generally I would recommend a).

Regards,

Rainer

Am 03.01.2017 um 12:38 schrieb BusFactor1 <busfactor1@gmail.com>:

Hello,

I’m working on a little typing game and when I added sound to the mix, LispWorks will consistently hang with this program.  More specifically, it seems that it starts crashing reliably once I added a call to stop-sound before my next call to play-sound in typing-handle-character.  

Source attached in typing.lisp which should run without any other dependencies.  Just run and start typing the words as they come across the screen, after less than 10 words usually it should either popup and error about a segmentation violation or hang the system and just stop working.

Hopefully this test program can help with improving the stability of LispWorks.

—
Burton Samograd


<typing.lisp><typewriter.wav>



Re: Crashing and Hanging LispWorks after adding sound to application

Hello,

Thank you for the advice.  Luckily, I just needed on change in defining the *typing-callback* to make sure my display callback was called properly in the main thread:

      (setf *typing-timer* (mp:make-timer #'gp:invalidate-rectangle pane))

Thank you.

Burton

On Jan 3, 2017, at 6:52 AM, Rainer Joswig <joswig@lisp.de> wrote:

Hi,

it crashes already without using the sounds after some typing. Mac, Lispworks 64bit, macOS Sierra.

I haven't looked closely, but I fear how you use threads and timers may not work.
Remember that the Mac wants things (drawing, ...) to happen in the main thread.
Just guessing.

The function FILTER is called REMOVE in Common Lisp. It does the same.

Also you have an unhealthy mix of global variables and closed over lexical variables. These variables are relevant for the pane.
I would recommend:

a) subclass the pane class and add the appropriate slots. Access the data via the pane objects slots.

or

b) capi-objects have property lists. An output-pane has a superclass capi-object. see capi:capi-object-property to get/set those.

Generally I would recommend a).

Regards,

Rainer

Am 03.01.2017 um 12:38 schrieb BusFactor1 <busfactor1@gmail.com>:

Hello,

I’m working on a little typing game and when I added sound to the mix, LispWorks will consistently hang with this program. More specifically, it seems that it starts crashing reliably once I added a call to stop-sound before my next call to play-sound in typing-handle-character. 

Source attached in typing.lisp which should run without any other dependencies. Just run and start typing the words as they come across the screen, after less than 10 words usually it should either popup and error about a segmentation violation or hang the system and just stop working.

Hopefully this test program can help with improving the stability of LispWorks.

—
Burton Samograd


<typing.lisp><typewriter.wav>

Updated at: 2020-12-10 08:31 UTC