Scratch locks up? (when playing sound?)


55 posts   Page 1 of 3   1, 2, 3
by mukslinger » Fri Sep 28, 2012 10:55 am
HI, Just got my raspberry last night. Had a couple issues so far, one was that I had to set the hdmi sound in the config in order to get any sound at all, and the other is with scratch. it seems to lock up.

what happens is, when I start it, it works fine, but sooner or later it just stops responding, it won't close or do anything and the cpu isn't doing much. I can open other programs and they will work, but scratch is just stuck on the screen. I can even open a new scratch, and it works, tho i havnt let the second one stay on long enough to see if that dies.

Is this a known issue with scratch or do I have something else going on?
Posts: 4
Joined: Fri Sep 28, 2012 10:48 am
by proxima » Fri Sep 28, 2012 11:45 am
I'm afraid this might not help much - but I've been using Scratch a bit (i.e. a couple of hours proper use, and several hours of it sitting there while I've been doing other things), and it's not hung in the way you described yet.

My entire Pi has locked up once - while I was using Scratch - but that appears to have been a one-off and more likely related to the dodgy power supply I was using at that point. But for Scratch to lock up and everything else including other Scratch sessions to carry on is not a problem I've seen so far, and it's not one of the "big 3" known problems with Scratch on Pi (you've probably already seen the other thread in this forum for details of those here: viewtopic.php?f=77&t=18676).

I hope someone else may be able to give you tips as to how to resolve your problem (including probably asking you what version of Rasperian and Scratch you're on), but it's not a known problem (or at least, not until now...?) with Scratch.
Posts: 30
Joined: Tue Sep 18, 2012 3:16 pm
by mukslinger » Fri Sep 28, 2012 1:04 pm
darn, yeah, I read the posts here hoping to find something similar, but no luck. It's like it freezes and stops, but just that session. the operating system seems fine, just that session is messed up. you can minimize it, but can't close it.

I'm going to try another power supply tonight, just in case, another sd card, maybe even a different keyboard and mouse (currently using a logitech wireless setup). If it isn't the software, it has to be something like that. That's my thought process anyway, maybe theres a guru out there that knows.

latest image of raspbian "wheezy", 32gb class4 sd card (I have a 4gb one), kodak zi8 power supply rated 5v 1A (i have a 5v 0.7 one from a samsung galazy phone)
Posts: 4
Joined: Fri Sep 28, 2012 10:48 am
by mukslinger » Mon Oct 01, 2012 9:49 am
Can't edit my post, so I'll have to double post to update.

It looks like it's a power supply / wireless keyboard and mouse issue. when using the mouse the cpu max's out and the power dips below 4.7, just slightly. So I've changed my power supply and that improved it a fair bit. Still locked up, but took a bit more use to do it. Removing the wireless dongle and using a wired mouse allowed me to use the program going on an hour. I had one more lock up, but I was really taxing the program. (lifting scratch up and wiggling the mouse like mad).

I'll pick up a powered usb hub, and I figure that should be the end of it.
Posts: 4
Joined: Fri Sep 28, 2012 10:48 am
by proxima » Tue Oct 09, 2012 6:29 pm
Just confirming I've got this same problem now. Not sure what's changed, but in the first half hour of using the Pi with my son, it locked up 4 times. Pretty hard to explain to a 6 year old why you're just going to kill the session again, and have to redo the last few minutes' work again.

I have run Scratch from the icon, and from the instructions here: viewtopic.php?f=77&t=18984 - it doesn't seem to make any difference to this problem; it's locked up a couple of times under each setup.

Going to get annoying really quickly - I'll try some different PSUs, keyboard/mouse combos etc to see if that makes any difference.
Posts: 30
Joined: Tue Sep 18, 2012 3:16 pm
by proxima » Tue Oct 09, 2012 9:01 pm
Although I've not confirmed it yet, there seems to be a strong correlation between this problem occurring and using sound in Scratch programs. If I don't use any sound, I don't seem to see this problem - as soon as I start putting sounds into the program, this problem starts to happen every few minutes.
Posts: 30
Joined: Tue Sep 18, 2012 3:16 pm
by mukslinger » Wed Oct 10, 2012 11:23 am
This sounds, pardon the pun, plausible that it could be related to sound. I had issues getting sound to work, I had to force hdmi to get it to work.

Each time that scratch locked up, I am certain that I dragged down a sound feature first (I would drag a move and a sound). The lock ups would occur randomly, no matter what I was doing after that. Once, we were just scrolling through the pictures for the avatars and it locked up.

I thought it might be related to my power supply, so I changed that out and all I did to test it after that was to pick up the avatar with the mouse and wiggle it around the screen, to make the cpu work for it and try to lock it up that way. I never thought that it could be related to a program sound. Because it would lock up even if you did nothing, you could watch the cpu and it would drop, when it did, scratch was frozen.

We havn't tried a sound feature in a while, I will try it tonight when I get home from work. When I was getting lock ups I always had the following program : move 10 steps, sound: meow, return to xy.

I will let you know how this goes.
Posts: 4
Joined: Fri Sep 28, 2012 10:48 am
by jeremyasmith » Wed Oct 10, 2012 12:28 pm
I also can confirm, scratch worked fine until I tried to 'meow' at which point it locked up, in my case the machine was frozen and I had to reboot, I tried this three times and it only seemed to happen with sound.
Posts: 1
Joined: Wed Oct 10, 2012 12:21 pm
by Wheel_nut » Wed Oct 10, 2012 9:43 pm
I use a powered Hub with ALL periphrals connected to the Hub so there is no possibility of the Mouse or other device dragging the RPi +5V rail down. I also have a DVM on the TPs and it reads a solid 5.1V.

I have found that Scratch locks up regularly if I have less than 3 Motion commands between successive Sound commands. I believe that the Sound device is getting swamped and is unable to stack the commands.
Posts: 132
Joined: Tue Sep 18, 2012 7:51 pm
by proxima » Fri Oct 12, 2012 11:56 am
Some more information about this one, which I will also cross-post to the Scratch forum at MIT.

I often run Scratch from a command prompt (i.e. start a command prompt and run 'scratch' from there). I have noticed that when using sound in Scratch, as well as getting the 'locking up' problem, there is an error message on the command prompt:

Code: Select all
snd_pcm_writei returned -1


This error often happens every few seconds. And when Scratch locks up, this message is scrolling up the screen repeatedly. So it seems that it might be related in some way to the Scratch lock-up.

A brief Google shows that the function snd_pcm_writei is something to do with the ALSA library's "pulse code modulation" feature - i.e. sound.

The same Scratch project, but with all 'play sound' removed, does NOT show that error ever, and has never locked up yet.

Without researching a lot more about what ALSA is, if there are alternatives, how it all works, I'm not going to get much further with that. But maybe that helps an expert cast more light on it. Again, I'm happy to test any fixes.
Posts: 30
Joined: Tue Sep 18, 2012 3:16 pm
by simplesi » Sun Oct 14, 2012 8:17 pm
Just thought I'd see if this happens on mine and it seemed to work OK but when I came back to the RPi after half an hour - I found that Scratch was locked up (Which has never happened with all my other playing about with it)

I think things start going wrong after a long pause - I can play around with the sounds to my hearts content - if I leave the RPi alone and go and do something else for a minute - it locks up when I come back to it

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter
Posts: 2053
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
by Stoick » Sun Oct 14, 2012 9:35 pm
Yesterday; opened Scratch, pressed play on "Meow" 3 times in a row (testing some speakers!) and scratch/pi locked up.
Posts: 4
Joined: Fri Oct 12, 2012 9:43 pm
by axis_mann » Tue Oct 23, 2012 8:00 pm
I noticed that when it locks up on me, using the drum beat example from magPi issue one, I can bring up the task manager, locate squeakvm in the command column, right click on it and select stop and then select continue to get scratch to start running again for one or more cpu cycles. Eventually however, it hangs up. I didn't try running any other experiments. Almost all the current software out there works this way or that way some of the time. I hope they can find the bug and fix it soon. It's too random for teaching purposes in my opinion.
Posts: 2
Joined: Sat Oct 13, 2012 3:30 am
by proxima » Wed Oct 24, 2012 1:42 pm
axis_mann wrote:I hope they can find the bug and fix it soon. It's too random for teaching purposes in my opinion.


Agreed, to a point. There are certainly a few problems that need to be fixed, specific either to Scratch on Raspberry Pi or on Linux in general. I've got 3 threads on the Scratch MIT forum (links at the bottom), but all three seem to have died a death with no progress (tried to resurrect a couple of them just now).

Given that I thought Scratch was one of the "flagship" parts of the whole Raspberry Pi concept, I wish someone from on-high within the RPi organisation would put some weight behind chasing these bugs which must be putting a lot of people off before they even get started.

It's pretty hard to know where to go from here. (I must say though that when the sticky keys workaround is in place, and without using any sound, my kids LOVE Scratch, and have already created about 6 games and learned a lot. It's just a couple of annoying glitches that really need to be fixed - hardly a disaster).

The threads in question on the other forum are:

http://scratch.mit.edu/forums/viewtopic.php?id=107594
http://scratch.mit.edu/forums/viewtopic.php?id=107704
http://scratch.mit.edu/forums/viewtopic.php?id=106380
Posts: 30
Joined: Tue Sep 18, 2012 3:16 pm
by simplesi » Wed Oct 24, 2012 10:07 pm
Given that I thought Scratch was one of the "flagship" parts of the whole Raspberry Pi concept, I wish someone from on-high within the RPi organisation would put some weight behind chasing these bugs which must be putting a lot of people off before they even get started.

+1000

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter
Posts: 2053
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
by ked » Fri Dec 21, 2012 5:27 pm
Edit: hmm, attachments not working "The uploaded file is empty". Anyone?
Edit2: Also, plug-in only plays sound, no recording yet.

Anyone still having problems with sound can try my newly minted plug-in. Very little testing but seems stable for me at least. HDMI output only atm (will provide option soon). To install download attached and...

$ sudo cp so.vm-sound-RPI /usr/lib/squeak/4.4.7-2357/

$ sudo nano /usr/bin/scratch

~ line 99, change...
VMOPTIONS="$VMOPTIONS -vm-sound-alsa"
to
VMOPTIONS="$VMOPTIONS -vm-sound-RPI"

save, exit, run Scratch. Have fun!
Posts: 40
Joined: Thu Aug 04, 2011 9:18 am
by ked » Sat Dec 22, 2012 12:11 am
Attachments still won't work for me so get it *here* for now.
Posts: 40
Joined: Thu Aug 04, 2011 9:18 am
by simplesi » Sat Dec 22, 2012 2:48 am
Great stuff - will test it out once Christmas is over and I'm allowed to play with my RPi again :)

Thanks for all the efforts your putting in :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter
Posts: 2053
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
by proxima » Sat Dec 22, 2012 9:31 am
ked wrote:Anyone still having problems with sound can try my newly minted plug-in.


Thanks ked - like simplesi, I'll test this as soon as I get a look-in on the Pi - maybe later this weekend.

Thanks for the work.

Tom
Posts: 30
Joined: Tue Sep 18, 2012 3:16 pm
by ked » Sat Dec 22, 2012 3:11 pm
Latency could be better but is passable (nothing I could do about it in the driver). Analogue output is bad. However HDMI is good and appears stable. This beats ALSA/PA which for me hung Scratch eventually. Hope this gives some parents a bit more mileage with those xmas Pi's ;)

Source Code & Binary
Posts: 40
Joined: Thu Aug 04, 2011 9:18 am
by cfrench77 » Wed Jan 02, 2013 11:04 am
Was playing Scratch this morning with two young children who were getting mildly frustrated that it froze, particularly when playing sound. The RPi was powered from a hub. Adding my usual Kindle power supply (so that it had two potential supplies) completely cured the problem.
Posts: 3
Joined: Mon Dec 03, 2012 3:12 pm
by winkleink » Thu Jan 03, 2013 5:13 pm
I think the Wheezy-2012-12-16 image (or updated Pi) has Pulse Audio implemented with some problems.

Since using this image Scratch has hung on me if I try to do anything complex and also I have no audio in Stella (2600 emulator) and Quake 3 where it use to all work before with the 2012-09-18 image.

I think I might switch back for now as I have a 256MB Raspberry Pi so I don't need the new image to make use of all the RAM.

It looks like some major changes were made involving Alsa and Pulse Audio that may not be as solid as it could be. Interestingly I remember Ubuntu going through the same thing when they started to use Pulse Audio. It's a better place once the niggles are worked out but until then there may be a few more strange things happening.
Twitter:Winkleink
Google+: Winkleink
User avatar
Posts: 218
Joined: Mon Nov 07, 2011 9:12 am
Location: UK
by malakai » Thu Jan 03, 2013 5:25 pm
I have tested the audio hdmi fix on a 512 with the latest image and have no issues with sound at all. Several people have installed Quake III and I have not heard any issues with sound on the new image.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
User avatar
Posts: 1383
Joined: Sat Sep 15, 2012 10:35 am
by winkleink » Thu Jan 03, 2013 6:16 pm
[quote="malakai"]I have tested the audio hdmi fix on a 512 with the latest image and have no issues with sound at all. Several people have installed Quake III and I have not heard any issues with sound on the new image.[/quote
Sorry for clarity the Quake 3 no sound was on the previous image. Sound perfect then I did an apt-get upgrade and sound stopped working in Syella, Quake 3 and Scratch as well as with splay.

I then burned the 2012-12-.. Image and sound works in Scratch until it hangs. For me usually when exiting full screen.

Stella has no audio and I have not reinstalled Quake 3 yet.

Sorry for not giving the full details. I know it's hard to figure out the true cause with conflicting information.
Twitter:Winkleink
Google+: Winkleink
User avatar
Posts: 218
Joined: Mon Nov 07, 2011 9:12 am
Location: UK
by winkleink » Thu Jan 03, 2013 6:40 pm
malakai wrote:I have tested the audio hdmi fix on a 512 with the latest image and have no issues with sound at all. Several people have installed Quake III and I have not heard any issues with sound on the new image.


Sorry for not being clear.

Quake 3 had sound on the 2012-09-.. image. I then did an upgrade and no sound in Quake 3, Stella or Scratch.
I burned the 2012-12-.. image and Scratch has sound but hangs, usually when I go from full screen back to Scratch

Stella stop had no sound and I did not install Quake 3 yet so do not know on the new image if Quake is affected.

Sorry for not being clear the first time. I know how tough it is to fix a problem with FALSE and misleading information.
Twitter:Winkleink
Google+: Winkleink
User avatar
Posts: 218
Joined: Mon Nov 07, 2011 9:12 am
Location: UK