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

Audio Recording Stops After Encountering Error #441

Closed
DSheirer opened this issue Oct 27, 2018 · 5 comments
Closed

Audio Recording Stops After Encountering Error #441

DSheirer opened this issue Oct 27, 2018 · 5 comments
Labels
Milestone

Comments

@DSheirer
Copy link
Owner

20181026 064858.641 [sdrtrunk pool-1-thread-7] ERROR i.g.d.audio.AudioManager - Encountered error while processing audio packets [600MB/1GB 58%]
java.lang.IllegalStateException: User count is below zero. This indicates that this buffer's decrement user count was invoked by more than the expected user count
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.recycle(AbstractReusableBuffer.java:118)
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.decrementUserCount(AbstractReusableBuffer.java:100)
at io.github.dsheirer.audio.AudioManager$AudioPacketProcessor.run(AudioManager.java:445)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

@DSheirer DSheirer added the bug label Oct 27, 2018
@DSheirer DSheirer added this to the Build 0.4.0 milestone Oct 27, 2018
@ImagoTrigger
Copy link
Contributor

another one

20181030 074230.058 [sdrtrunk pool-1-thread-5] ERROR i.g.d.audio.AudioManager - Encountered error while processing audio packets [627MB/1GB 61%]
java.lang.IllegalStateException: User count is below zero. This indicates that this buffer's decrement user count was invoked by more than the expected user count
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.recycle(AbstractReusableBuffer.java:118)
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.decrementUserCount(AbstractReusableBuffer.java:100)
at io.github.dsheirer.audio.AudioManager$AudioPacketProcessor.run(AudioManager.java:445)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
20181030 074230.908 [sdrtrunk pool-1-thread-3] ERROR i.g.d.d.f.c.o.ChannelOutputProcessor - Error while processing polyphase channel samples [677MB/1GB 66%]
java.lang.IllegalStateException: User count is below zero. This indicates that this buffer's decrement user count was invoked by more than the expected user count
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.recycle(AbstractReusableBuffer.java:118)
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.decrementUserCount(AbstractReusableBuffer.java:100)
at io.github.dsheirer.record.RecorderManager.receive(RecorderManager.java:108)
at io.github.dsheirer.record.RecorderManager.receive(RecorderManager.java:40)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:42)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:23)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.module.decode.p25.audio.P25AudioModule.processAudio(P25AudioModule.java:166)
at io.github.dsheirer.module.decode.p25.audio.P25AudioModule.receive(P25AudioModule.java:115)
at io.github.dsheirer.module.decode.p25.audio.P25AudioModule.receive(P25AudioModule.java:39)
at io.github.dsheirer.sample.Broadcaster.broadcast(Broadcaster.java:121)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.module.decode.Decoder$MessageDistributor.receive(Decoder.java:102)
at io.github.dsheirer.module.decode.Decoder$MessageDistributor.receive(Decoder.java:95)
at io.github.dsheirer.module.decode.p25.P25MessageProcessor.receive(P25MessageProcessor.java:90)
at io.github.dsheirer.module.decode.p25.P25MessageProcessor.receive(P25MessageProcessor.java:29)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.dispatch(P25MessageFramer.java:174)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.access$300(P25MessageFramer.java:38)
at io.github.dsheirer.module.decode.p25.P25MessageFramer$P25MessageAssembler.checkComplete(P25MessageFramer.java:317)
at io.github.dsheirer.module.decode.p25.P25MessageFramer$P25MessageAssembler.receive(P25MessageFramer.java:247)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.receive(P25MessageFramer.java:183)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.receive(P25MessageFramer.java:38)
at io.github.dsheirer.sample.Broadcaster.broadcast(Broadcaster.java:121)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.dsp.psk.PSKDemodulator.broadcast(PSKDemodulator.java:58)
at io.github.dsheirer.dsp.psk.DQPSKGardnerDemodulator.calculateSymbol(DQPSKGardnerDemodulator.java:88)
at io.github.dsheirer.dsp.psk.PSKDemodulator.receive(PSKDemodulator.java:115)
at io.github.dsheirer.dsp.psk.PSKDemodulator.receive(PSKDemodulator.java:89)
at io.github.dsheirer.module.decode.p25.P25DecoderLSM.receive(P25DecoderLSM.java:104)
at io.github.dsheirer.module.decode.p25.P25DecoderLSM.receive(P25DecoderLSM.java:33)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:42)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:23)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.sample.buffer.ReusableComplexBufferAssembler.flush(ReusableComplexBufferAssembler.java:153)
at io.github.dsheirer.sample.buffer.ReusableComplexBufferAssembler.receive(ReusableComplexBufferAssembler.java:127)
at io.github.dsheirer.sample.buffer.ReusableComplexBufferAssembler.receive(ReusableComplexBufferAssembler.java:139)
at io.github.dsheirer.dsp.filter.channelizer.output.TwoChannelOutputProcessor.process(TwoChannelOutputProcessor.java:117)
at io.github.dsheirer.dsp.filter.channelizer.output.ChannelOutputProcessor.processChannelResults(ChannelOutputProcessor.java:125)
at io.github.dsheirer.dsp.filter.channelizer.PolyphaseChannelSource.processSamples(PolyphaseChannelSource.java:246)
at io.github.dsheirer.source.tuner.channel.TunerChannelSource$ScheduledIntervalProcessor.run(TunerChannelSource.java:303)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
20181030 074234.606 [sdrtrunk pool-1-thread-8] WARN i.g.d.record.RecorderManager - overflow - audio packets will be dropped until recording catches up [270MB/1GB 26%]

@DSheirer
Copy link
Owner Author

20181030 074230.058 [sdrtrunk pool-1-thread-5] ERROR i.g.d.audio.AudioManager - Encountered error while processing audio packets [627MB/1GB 61%]
java.lang.IllegalStateException: User count is below zero. This indicates that this buffer's decrement user count was invoked by more than the expected user count
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.recycle(AbstractReusableBuffer.java:118)
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.decrementUserCount(AbstractReusableBuffer.java:100)
at io.github.dsheirer.audio.AudioManager$AudioPacketProcessor.run(AudioManager.java:445)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
20181030 074230.908 [sdrtrunk pool-1-thread-3] ERROR i.g.d.d.f.c.o.ChannelOutputProcessor - Error while processing polyphase channel samples [677MB/1GB 66%]
java.lang.IllegalStateException: User count is below zero. This indicates that this buffer's decrement user count was invoked by more than the expected user count
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.recycle(AbstractReusableBuffer.java:118)
at io.github.dsheirer.sample.buffer.AbstractReusableBuffer.decrementUserCount(AbstractReusableBuffer.java:100)
at io.github.dsheirer.record.RecorderManager.receive(RecorderManager.java:108)
at io.github.dsheirer.record.RecorderManager.receive(RecorderManager.java:40)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:42)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:23)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.module.decode.p25.audio.P25AudioModule.processAudio(P25AudioModule.java:166)
at io.github.dsheirer.module.decode.p25.audio.P25AudioModule.receive(P25AudioModule.java:115)
at io.github.dsheirer.module.decode.p25.audio.P25AudioModule.receive(P25AudioModule.java:39)
at io.github.dsheirer.sample.Broadcaster.broadcast(Broadcaster.java:121)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.module.decode.Decoder$MessageDistributor.receive(Decoder.java:102)
at io.github.dsheirer.module.decode.Decoder$MessageDistributor.receive(Decoder.java:95)
at io.github.dsheirer.module.decode.p25.P25MessageProcessor.receive(P25MessageProcessor.java:90)
at io.github.dsheirer.module.decode.p25.P25MessageProcessor.receive(P25MessageProcessor.java:29)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.dispatch(P25MessageFramer.java:174)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.access$300(P25MessageFramer.java:38)
at io.github.dsheirer.module.decode.p25.P25MessageFramer$P25MessageAssembler.checkComplete(P25MessageFramer.java:317)
at io.github.dsheirer.module.decode.p25.P25MessageFramer$P25MessageAssembler.receive(P25MessageFramer.java:247)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.receive(P25MessageFramer.java:183)
at io.github.dsheirer.module.decode.p25.P25MessageFramer.receive(P25MessageFramer.java:38)
at io.github.dsheirer.sample.Broadcaster.broadcast(Broadcaster.java:121)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.dsp.psk.PSKDemodulator.broadcast(PSKDemodulator.java:58)
at io.github.dsheirer.dsp.psk.DQPSKGardnerDemodulator.calculateSymbol(DQPSKGardnerDemodulator.java:88)
at io.github.dsheirer.dsp.psk.PSKDemodulator.receive(PSKDemodulator.java:115)
at io.github.dsheirer.dsp.psk.PSKDemodulator.receive(PSKDemodulator.java:89)
at io.github.dsheirer.module.decode.p25.P25DecoderLSM.receive(P25DecoderLSM.java:104)
at io.github.dsheirer.module.decode.p25.P25DecoderLSM.receive(P25DecoderLSM.java:33)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:42)
at io.github.dsheirer.sample.buffer.ReusableBufferBroadcaster.broadcast(ReusableBufferBroadcaster.java:23)
at io.github.dsheirer.sample.Broadcaster.receive(Broadcaster.java:39)
at io.github.dsheirer.sample.buffer.ReusableComplexBufferAssembler.flush(ReusableComplexBufferAssembler.java:153)
at io.github.dsheirer.sample.buffer.ReusableComplexBufferAssembler.receive(ReusableComplexBufferAssembler.java:127)
at io.github.dsheirer.sample.buffer.ReusableComplexBufferAssembler.receive(ReusableComplexBufferAssembler.java:139)
at io.github.dsheirer.dsp.filter.channelizer.output.TwoChannelOutputProcessor.process(TwoChannelOutputProcessor.java:117)
at io.github.dsheirer.dsp.filter.channelizer.output.ChannelOutputProcessor.processChannelResults(ChannelOutputProcessor.java:125)
at io.github.dsheirer.dsp.filter.channelizer.PolyphaseChannelSource.processSamples(PolyphaseChannelSource.java:246)
at io.github.dsheirer.source.tuner.channel.TunerChannelSource$ScheduledIntervalProcessor.run(TunerChannelSource.java:303)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
20181030 074234.606 [sdrtrunk pool-1-thread-8] WARN i.g.d.record.RecorderManager - overflow - audio packets will be dropped until recording catches up [270MB/1GB 26%]

@ImagoTrigger
Copy link
Contributor

got this one

20181103 055334.555 [sdrtrunk pool-1-thread-6] WARN i.g.d.record.RecorderManager - overflow - audio packets will be dropped until recording catches up [670MB/1GB 65%]

w/o any other errors/warnings and recording stops until the app is restarted again.

@ImagoTrigger
Copy link
Contributor

same thing again, system is not even that busy during the weekend mornings which is when i like to work on these things ;-)

@ImagoTrigger
Copy link
Contributor

turned it into a warning... always followed by an overflow few seconds later.. the info output is from my health patch

20181107 053803.372 [sdrtrunk pool-1-thread-2] WARN i.g.d.s.b.AbstractReusableBuffer - User count is below zero. This indicates that this buffer's decrement user count was invoked by more than the expected user count [637MB/1GB 62%]
20181107 053806.887 [sdrtrunk pool-1-thread-5] INFO i.g.d.m.d.p25.P25DecoderState - 40D - TSBK/s: 5 @ 1541590686 [799MB/1GB 78%]
20181107 053807.227 [sdrtrunk pool-1-thread-4] INFO i.g.d.m.d.p25.P25DecoderState - 402 - TSBK/s: 19 @ 1541590687 [815MB/1GB 79%]
20181107 053811.961 [sdrtrunk pool-1-thread-5] INFO i.g.d.m.d.p25.P25DecoderState - 40D - TSBK/s: 8 @ 1541590691 [434MB/1GB 42%]
20181107 053812.250 [sdrtrunk pool-1-thread-7] INFO i.g.d.m.d.p25.P25DecoderState - 402 - TSBK/s: 16 @ 1541590692 [459MB/1GB 44%]
20181107 053814.776 [sdrtrunk pool-1-thread-1] WARN i.g.d.record.RecorderManager - overflow - audio packets will be dropped until recording catches up [682MB/1GB 66%]

whelgeson pushed a commit to whelgeson/sdrtrunk that referenced this issue Dec 15, 2018
Method doc reads that the method is thread-safe, but there exist no locking to ensure thread safety on call into recycle method. Modifying the decrementUserCount method to block other callers to ensure thread-safe access.

This appears to be a hot area of code and there may be a performance hit by doing this, please double check my work here.
DSheirer pushed a commit that referenced this issue Dec 17, 2018
* Fix for issue #441.
Method doc reads that the method is thread-safe, but there exist no locking to ensure thread safety on call into recycle method. Modifying the decrementUserCount method to block other callers to ensure thread-safe access.

This appears to be a hot area of code and there may be a performance hit by doing this, please double check my work here.

* Moving synchronized to recycle method as it's accessed by two different methods that could potentially cause an unsafe access race condition.

* Revert - synchronizing recycle does not protect against multiple recycle calls on the same object.
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