Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007701 [Squeak] VM crash always 08-03-12 00:07 08-08-12 11:59
Reporter lewis View Status public  
Assigned To lewis
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0007701: Pulse audio Scratch plugin causes seg fault on 64bit Ubuntu installation
Description Date: Thu, 2 Aug 2012 17:36:42 -0400
From: Amos Blanton <amos@scratch.mit.edu>
To: Squeak Virtual Machine Development Discussion <vm-dev@lists.squeakfoundation.org>
Subject: [Vm-dev] Pulse audio Scratch plugin causes seg fault on 64bit Ubuntu installation

To reproduce:

1. Execute Scratch using current VM and pulse plugin (on Ubuntu 12.04, 64
bit system):
Executing: /usr/lib/squeak/4.4.7-2357/squeakvm -encoding UTF-8
-vm-display-x11 -xshm -plugins
/usr/lib/scratch/plugins/:/usr/lib/squeak/4.4.7-2357/ -vm-sound-pulse
/usr/share/scratch/Scratch.image
(There is no pulse plugin in /usr/lib/scratch/plugins in my installation
package, so it must be using the one in /usr/lib/squeak/4.4.7-2357)

2. Click "Sounds" tab, click play icon next to meow. That results in:

Segmentation fault

10273532 [] in SoundPlayer class>playLoop
10262332 Semaphore>critical:
10262240 SoundPlayer class>playLoop
10273228 [] in SoundPlayer class>startPlayerProcessBufferSize:rate:stereo:
10273320 [] in BlockContext>newProcess
Aborted (core dumped)

Note that the same package on 32 bit systems does not produce the error
(playback and recording both work).

The issue is also described here:
https://bugs.launchpad.net/ubuntu/+source/squeak-vm/+bug/1009080 [^]

If someone can take a look and patch this, we'd very much appreciate it!
This is the last major (known) issue we've got with Scratch running on
Ubuntu.

-Amos
Additional Information
Attached Files  sqUnixSoundPulseAudio.c [^] (32,394 bytes) 08-03-12 11:55
 audioIO_t-alignment.txt [^] (1,139 bytes) 08-03-12 11:56
 platforms-unix-sound-pulse-sqUnixSoundPulse.c.tar [^] (40,960 bytes) 08-08-12 00:34

- Relationships

- Notes
(0014239 - 488 - 510 - 510 - 510 - 510 - 510)
dmoc
08-03-12 12:03
edited on: 08-03-12 12:05

I created the PA plugin but I'm not set-up for 64-bit and never done any 64-bit porting. That said, I've looked at the audioIO_t struct and factored in 64-bit type alignments (AFAIK). You can see the calc's in the attached audioIO_t-alignment.txt (paste into a spreadsheet if difficult to read). Based on this a dummy INT has been added to force the uint32 "rate" of pa_sample_spec to be also 8-byte aligned. I'd be grateful if someone geared up for 64-bit compiling would give it a go.

 
(0014240 - 1979 - 2073 - 2073 - 2073 - 2073 - 2073)
lewis
08-07-12 01:24

I am having trouble reproducing the crash because I cannot figure out how to get pulse audio activated on my SuSE Linux box and the Scratch kitty does "meow" just fine on my 64-bit VM. But I did load enough of Gnome to be able to build vm-sound-pulse in 64-bit mode. I get the following compiler warnings both with and without the alignment patch, so I expect there are some type declaration issues.

Scanning dependencies of target vm-sound-pulse
[100%] Building C object vm-sound-pulse/CMakeFiles/vm-sound-pulse.dir/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c.o
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c: In function ‘sound_PlaySamplesFromAtLength’:
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c:842:42: warning: cast to pointer from integer of different size
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c: In function ‘sound_RecordSamplesIntoAtLength’:
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c:1034:34: warning: cast to pointer from integer of different size
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c: At top level:
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c:1116:1: warning: initialization from incompatible pointer type
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c:1116:1: warning: initialization from incompatible pointer type
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c:1116:1: warning: initialization from incompatible pointer type
/home/lewis/squeak/Squeak3.10-dev/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c:1116:1: warning: initialization from incompatible pointer type
Linking C shared module so.vm-sound-pulse
[100%] Built target vm-sound-pulse
 
(0014241 - 598 - 620 - 620 - 620 - 620 - 620)
lightnin
08-07-12 01:51

Partly because of the problems on 64 bit machines, the Scratch startup script in /usr/bin/scratch on the latest Debian Scratch package is setup to use the OSS sound plugin (within "padsp", a pulseaudio compatibility wrapper if pulse is present). You'll need to edit that script to use vm-sound-pulse, or just execute the startup command as follows (assuming Suse installation has similar locations / squeak vm revs)

/usr/lib/squeak/4.4.7-2357/squeakvm -encoding UTF-8 -vm-display-x11 -plugins /usr/lib/scratch/plugins/:/usr/lib/squeak/4.4.7-2357/ -vm-sound-pulse /usr/share/scratch/Scratch.image
 
(0014242 - 521 - 533 - 533 - 533 - 533 - 533)
lewis
08-08-12 00:22

I cannot test on my system but I am quite confident that the problem is caused by variable declarations that cause 8-byte pointers to be stored in 4-byte integer variables. I think that it can be fixed simply by changing function declarations in platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c to match the prototypes in Cross/plugins/SoundPlugin/SoundPlugin.h.

The VM crashes are the result of primitive calls in the plugin that pass 8-byte pointers to support code functions that treat them as 4-byte integers.
 
(0014243 - 284 - 296 - 296 - 296 - 296 - 296)
lewis
08-08-12 00:37

platforms-unix-sound-pulse-sqUnixSoundPulse.c.tar contains an update to sqUnixSoundPulse.c that should fix the type declaration problems. It does not include the structure alignment change, as this very likely will prove unnecessary.

This needs to be tested on Ubuntu with Scratch.
 
(0014244 - 149 - 155 - 353 - 353 - 353 - 353)
lewis
08-08-12 11:59

Patch included in trunk SVN 2581, tested and confirmed by Derek O'Connell
http://lists.squeakfoundation.org/pipermail/vm-dev/2012-August/011097.html [^]
 

- Issue History
Date Modified Username Field Change
08-03-12 00:07 lewis New Issue
08-03-12 00:07 lewis Status new => assigned
08-03-12 00:07 lewis Assigned To  => lewis
08-03-12 11:55 dmoc File Added: sqUnixSoundPulseAudio.c
08-03-12 11:56 dmoc File Added: audioIO_t-alignment.txt
08-03-12 12:03 dmoc Note Added: 0014239
08-03-12 12:05 dmoc Note Edited: 0014239
08-04-12 13:37 lewis Status assigned => acknowledged
08-07-12 01:24 lewis Note Added: 0014240
08-07-12 01:51 lightnin Note Added: 0014241
08-08-12 00:22 lewis Note Added: 0014242
08-08-12 00:34 lewis File Added: platforms-unix-sound-pulse-sqUnixSoundPulse.c.tar
08-08-12 00:37 lewis Note Added: 0014243
08-08-12 11:59 lewis Status acknowledged => resolved
08-08-12 11:59 lewis Resolution open => fixed
08-08-12 11:59 lewis Note Added: 0014244


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
67 total queries executed.
41 unique queries executed.
Powered by Mantis Bugtracker