Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing some sounds cause finalisation error on primClose: #6

Closed
timrowledge opened this issue Jun 9, 2014 · 6 comments
Closed
Assignees
Labels

Comments

@timrowledge
Copy link
Contributor

bhp reports -
'import sounds, Music Loops, Eggs gives a MPEG-Error.
http://www.raspberrypi.org/forums/download/file.php?id=6985
Sound is 'playable' then, when I choose proceed.

@timrowledge timrowledge added the bug label Jun 9, 2014
@timrowledge timrowledge self-assigned this Jun 9, 2014
@timrowledge
Copy link
Contributor Author

Hmm. Odd. The file referred to is not an mp3 file - in fact there aren't any I can find in the default media - but the failure is in finalising an mpegfile of some sort.
Email ghp for more details.

@heppg
Copy link

heppg commented Jun 17, 2014

Difficult to reproduce, and I do not see a pattern. When I open the file (its the same with loops/cave), doubleclick the file in file dialog. Sound starts, then, before end of tune, click ok. In one out of three, four attempts I get the error. When I got the error, I restart scratch to have clean conditions.

Error: Error: primFileClose: failed
17 June 2014 9:41:37.481 pm

VM: unix - Smalltalk
Image: Squeak4.5 [latest update: #13680]

SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir /home/pi
Trusted Dir /home/pi/secure
Untrusted Dir /home/pi/My Squeak

MPEGFile(Object)>>error:
Receiver: a MPEGFile
Arguments and temporary variables:
t1: 'Error: primFileClose: failed'
Receiver's instance variables:
pathToFile: '/usr/share/scratch/Media/Sounds/Music Loops/Cave.mp3'
fileBits: #[0 0 0 0]
fileIndex: 6
isBigEndian: nil

[] in WeakArray class>>finalizationProcess
Receiver: WeakArray
Arguments and temporary variables:
<
Receiver's instance variables:
superclass: Array
methodDict: a MethodDictionary()
format: 514
instanceVariables: nil
organization: ('as yet unclassified')

    subclasses:     nil
    name:   #WeakArray
    classPool:  a Dictionary(#FinalizationDependents->a WeakArray(a WeakRegistry(<th...etc...
    sharedPools:    nil
    environment:    Smalltalk
    category:   #'Collections-Weak'

Semaphore>>critical:ifError:
Receiver: a Semaphore()
Arguments and temporary variables:
<
Receiver's instance variables:
firstLink: nil
lastLink: nil
excessSignals: 1

WeakArray class>>finalizationProcess
Receiver: WeakArray
Arguments and temporary variables:
t1: true
Receiver's instance variables:
superclass: Array
methodDict: a MethodDictionary()
format: 514
instanceVariables: nil
organization: ('as yet unclassified')

    subclasses:     nil
    name:   #WeakArray
    classPool:  a Dictionary(#FinalizationDependents->a WeakArray(a WeakRegistry(<th...etc...
    sharedPools:    nil
    environment:    Smalltalk
    category:   #'Collections-Weak'

[] in WeakArray class>>restartFinalizationProcess
Receiver: WeakArray
Arguments and temporary variables:

Receiver's instance variables: 
    superclass:     Array
    methodDict:     a MethodDictionary()
    format:     514
    instanceVariables:  nil
    organization:   ('as yet unclassified')

    subclasses:     nil
    name:   #WeakArray
    classPool:  a Dictionary(#FinalizationDependents->a WeakArray(a WeakRegistry(<th...etc...
    sharedPools:    nil
    environment:    Smalltalk
    category:   #'Collections-Weak'

[] in BlockClosure>>newProcess
Receiver: [closure] in WeakArray class>>restartFinalizationProcess
Arguments and temporary variables:

Receiver's instance variables: 
    outerContext:   WeakArray class>>restartFinalizationProcess
    startpc:    119
    numArgs:    0

--- The full stack ---
MPEGFile(Object)>>error:
[] in WeakArray class>>finalizationProcess
Semaphore>>critical:ifError:
WeakArray class>>finalizationProcess
[] in WeakArray class>>restartFinalizationProcess
[] in BlockClosure>>newProcess

@timrowledge
Copy link
Contributor Author

OK, the good news is that the debug log reveals the name of the file and confirms that it is an mp3 file - so we're not dealing with code gone mad and trying to import a .wav as mp3 eetc. Whew.
This -
"doubleclick the file in file dialog. Sound starts, then, before end of tune, click ok. "
suggests to me that there might be an issue with the sound preview clashing with the select-and-load. Let's see where that leads...

@timrowledge
Copy link
Contributor Author

Ooh, it's good we had this problem; there's actually some missing code relating to importing stereo mp3 files. We need to merge stereo into mono for the project file format; space saving or some such idea. That part being fixed, back to .... whatever we were doing.

@timrowledge
Copy link
Contributor Author

Clicking on a sound file makes the system start playing it - as long as it is an understood file format. In the case of mp3 files, it opens the file and starts playing it as a StreamingMP3Sound and does NOT close the file after reading it all in as with any .wav or other files. This means the file is left for the finalisation process to close, which is why we see this error as part of the finaliser loop.

I'm having a lot of trouble seeing how we can get the error but since it doesn't matter if we try to close an already finalised file a simple solution is to avoid the primitive raising the error in the first place. So far, so good.

@timrowledge
Copy link
Contributor Author

Fix in place for the next beat release; keep an eye - or ear! - open for this in future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants