cubeb_alsa.c:336: alsa_refill_stream Topic is solved

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

cubeb_alsa.c:336: alsa_refill_stream

Unread post by Lunokhod » 2017-11-29, 20:40

PM 27.6.0 LInux 32 bit - I have had ongoing trouble with occasional crashes on duolingo, over several PM version updates. Sometimes several days pass without any, other times 2 or 3 in a few minutes. And this is with just that one tab open too, as it happens more often when other tabs are open, also it seems to happen more at times of high internet traffic in the early evening. So I have just started PM from the command line, and left the duolingo page open while doing other things as it didn't actually crash when I was on there today . Just now I had Yandex mail open and logged in as well, and logged out of mail.ru, then searched for "harley davidson" which was trending on mail.ru search (for no other reason really) and hooray, it crashed at last with an error message!
palemoon: /home/trava90/PaleMoon/pmsrc/media/libcubeb/src/cubeb_alsa.c:336: alsa_refill_stream: Assertion `wrote >= 0 && wrote == got' failed.
Aborted
I am not using pulse audio, only alsa, and sound is working fine on the duolingo site for me.
I had earlier turned on these in about:config but I think they might need further actions to do much, I'm not sure how best to log things for troubleshooting PM:
devtools.debugger.log
devtools.debugger.log.verbose


Full output to terminal below, I might be able to capture more examples of crash error messages in future but this seemed a helpful start anyhow. :thumbup:

Code: Select all

$ palemoon
[1511981860153] ABP timeline: Adblock Plus startup                                                            	 (first event)
[1511981860156] ABP timeline: * Done registering public API                                                   	 (3)
[1511981860218] ABP timeline: * Entered filter listener initialization()                                      	 (62)
[1511981860219] ABP timeline: * * Entered ElemHide.init()                                                     	 (1)
[1511981860225] ABP timeline: * * * done adding prefs listener                                                	 (6)
[1511981860243] ABP timeline: * * * done determining stylesheet URL                                           	 (18)
[1511981860243] ABP timeline: * * ElemHide.init() done                                                        	 (0)
[1511981860243] ABP timeline: * * Entered FilterStorage.loadFromDisk()                                        	 (0)
[1511981860245] ABP timeline: * * * FilterStorage.loadFromDisk() -> readFile()                                	 (2)
[1511981860252] ABP timeline: * * * FilterStorage.loadFromDisk() <- readFile() (async action pending)         	 (7)
[1511981860252] ABP timeline: * * FilterStorage.loadFromDisk() done                                           	 (0)
[1511981860253] ABP timeline: * * done initializing data structures                                           	 (1)
[1511981860253] ABP timeline: * * done adding observers                                                       	 (0)
[1511981860253] ABP timeline: * Filter listener initialization done                                           	 (0)
[1511981860254] ABP timeline: * Done loading filter listener                                                  	 (1)
[1511981860262] ABP timeline: * Entered content policy initialization                                         	 (8)
[1511981860276] ABP timeline: * * done initializing types                                                     	 (14)
[1511981860282] ABP timeline: * * registering global stylesheet                                               	 (6)
[1511981860290] ABP timeline: * * done registering stylesheet                                                 	 (8)
[1511981860290] ABP timeline: * Done initializing content policy                                              	 (0)
[1511981860293] ABP timeline: * Done loading content policy                                                   	 (3)
[1511981860309] ABP timeline: * Entered Synchronizer.init()                                                   	 (16)
[1511981860312] ABP timeline: * Synchronizer.init() done                                                      	 (3)
[1511981860315] ABP timeline: * Done loading subscription synchronizer                                        	 (3)
[1511981860317] ABP timeline: * Entered Notification.init()                                                   	 (2)
[1511981860319] ABP timeline: * Notification.init() done                                                      	 (2)
[1511981860319] ABP timeline: * Done loading notification downloader                                          	 (0)
[1511981860368] ABP timeline: * Done loading UI integration code                                              	 (49)
[1511981860368] ABP timeline: Started up                                                                      	 (0)
ABP timeline: Total time elapsed: 216
ABP timeline: Warning: Processing reentered for async action FilterStorageRead
ABP timeline: Warning: Processing reentered for async action FilterStorageRead
[1511981879103] ABP timeline: Async action FilterStorageRead done                                             	 (0/18851)
[1511981879108] ABP timeline: FilterStorage.loadFromDisk() read callback                                      	 (first event)
[1511981879109] ABP timeline: * Initializing data done, triggering observers                                  	 (1)
[1511981881978] ABP timeline: * Entered ElemHide.apply()                                                      	 (2869)
[1511981881980] ABP timeline: * * start grouping selectors                                                    	 (2)
[1511981882704] ABP timeline: * * done grouping selectors                                                     	 (724)
[1511981882729] ABP timeline: * ElemHide.apply() done (async action pending)                                  	 (25)
[1511981882782] ABP timeline: FilterStorage.loadFromDisk() read callback done                                 	 (53)
ABP timeline: Total time elapsed: 3678
ABP timeline: Warning: Processing not entered for async action FilterStorageRead
ABP timeline: Warning: Processing not entered for async action FilterStorageRead
[1511981885028] ABP timeline: Async action ElemHideWrite done                                                 	 (1252/2293)
[1511981885029] ABP timeline: ElemHide.apply() write callback                                                 	 (first event)
[1511981885029] ABP timeline: * ElemHide.unapply() finished                                                   	 (0)
[1511981885835] ABP timeline: * Applying stylesheet finished                                                  	 (806)
[1511981885836] ABP timeline: ElemHide.apply() write callback done                                            	 (1)
ABP timeline: Total time elapsed: 807
[1511982221254] ABP timeline: Entered FilterStorage.saveToDisk()                                              	 (first event)
[1511982221293] ABP timeline: * FilterStorage.saveToDisk() -> writeFilters()                                  	 (39)
[1511982221538] ABP timeline: * FilterStorage.saveToDisk() -> writeFilters() (async action pending)           	 (245)
[1511982221538] ABP timeline: FilterStorage.saveToDisk() done                                                 	 (0)
ABP timeline: Total time elapsed: 285
[1511982224450] ABP timeline: Async action FilterStorageWrite done                                            	 (1737/2912)
[1511982224452] ABP timeline: FilterStorage.saveToDisk() write callback                                       	 (first event)
[1511982224452] ABP timeline: FilterStorage.saveToDisk() write callback done                                  	 (0)
ABP timeline: Total time elapsed: 0
1511983702712	addons.update-checker	WARN	Update manifest for {972ce4c6-7e08-4474-a285-3208198ce6fd} did not contain an updates property
[1511985821807] ABP timeline: Entered FilterStorage.saveToDisk()                                              	 (first event)
[1511985821814] ABP timeline: * FilterStorage.saveToDisk() -> writeFilters()                                  	 (7)
[1511985822206] ABP timeline: * FilterStorage.saveToDisk() -> writeFilters() (async action pending)           	 (392)
ABP timeline: Warning: Async action FilterStorageWrite already executing
[1511985822207] ABP timeline: FilterStorage.saveToDisk() done                                                 	 (1)
ABP timeline: Total time elapsed: 400
[1511985825159] ABP timeline: Async action FilterStorageWrite done                                            	 (1774/2953)
[1511985825161] ABP timeline: FilterStorage.saveToDisk() write callback                                       	 (first event)
[1511985825161] ABP timeline: FilterStorage.saveToDisk() write callback done                                  	 (0)
ABP timeline: Total time elapsed: 1
palemoon: /home/trava90/PaleMoon/pmsrc/media/libcubeb/src/cubeb_alsa.c:336: alsa_refill_stream: Assertion `wrote >= 0 && wrote == got' failed.
Aborted
Wait, it's all Ohio? Always has been...

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35477
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Moonchild » 2017-11-29, 22:28

Thanks for the report. Seems an odd situation to hit, but then again, this is low-level Linux we're talking about.
See: Issue #1515
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Lunokhod » 2017-11-30, 03:39

That's fast! I thought I would check back just in case of a reply and didn't expect to see a patch :D
Looking at the area it fails, those seem to be Alsa lib functions causing the unexpected return value. To add some background info that may be of interest, there is something not quite right about the interface between Alsa, the kernel driver and sound card on my system here, I should point out, because it is muted at boot but Alsa shows it as unmuted.
So I run this script at boot:

Code: Select all

#! /bin/bash

aplay /usr/share/orage/sounds/Tear.wav >/dev/null 2>&1
sleep 1
amixer set PCM mute >/dev/null 2>&1
amixer set PCM unmute >/dev/null 2>&1
amixer set Master mute >/dev/null 2>&1
amixer set Master unmute >/dev/null 2>&1
The only reason to mute it first is that alsa doesn't actually send a command at all if it thinks it is already in that state, and I have to try and play a sound first (which a year or so ago wasn't required). So whether that is support for my older hardware being lost from the kernel driver over time or even just some faulty capacitor or something on the sound card to blame I don't know for certain, although sound muted on boot is not an uncommon issue to see online and the sound works entirely normally otherwise. I am pretty sure Alsa is doing what it does correctly (regarding the muting and unmuting at least), it basically only sends commands to the kernel, I didn't look into the kernel driver though.

Thanks for looking at that so quickly, and hopefully it will indeed have some wider relevance for the stability of Pale Moon too.

(From sudo lspci -vvv)

Code: Select all

00:1f.5 Multimedia audio controller: Intel Corporation 82801CA/CAM AC'97 Audio Controller (rev 02)
	Subsystem: Cirrus Logic Crystal WMD Audio Codec
	Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin B routed to IRQ 5
	Region 0: I/O ports at d800 [size=256]
	Region 1: I/O ports at dc80 [size=64]
	Kernel driver in use: snd_intel8x0
	Kernel modules: snd_intel8x0
Wait, it's all Ohio? Always has been...

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35477
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Moonchild » 2017-12-06, 09:46

Our unstable release has the fix applied; if you could verify it no longer asserts, that would be great!
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Lunokhod » 2017-12-07, 19:56

Looks a bit tricky if this is the correct page:
http://linux.palemoon.org/download/unstable/
"These versions are only available for Linux 64-bit."
And my laptop is 32 bit :eh: (I know someone with a 64 bit desktop where I can occasionally try things out, but I don't know if the problem existed there originally, and it would be difficult to try it over a long enough time span)
But I can add that I have been starting Pale Moon from the command line since my first post, and every crash has been with this same error and on Duolingo:
palemoon: /home/trava90/PaleMoon/pmsrc/media/libcubeb/src/cubeb_alsa.c:336: alsa_refill_stream: Assertion `wrote >= 0 && wrote == got' failed.
I got 2 of these this evening.
Wait, it's all Ohio? Always has been...

User avatar
trava90
Contributing developer
Contributing developer
Posts: 1736
Joined: 2013-05-20, 18:19
Location: Somewhere in Sector 001

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by trava90 » 2017-12-07, 19:58

We also have a contributed 32-bit Linux unstable build: viewtopic.php?f=37&t=14482

User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Lunokhod » 2017-12-07, 20:20

Thank you, I shall give that a try. I looked into building it myself but spotted this build requirement "at least 4 GB Ram" which seemed unpromising as I had 1! It would probably take an hour or two at least for me to build even if it did work, so that's a big help.
Wait, it's all Ohio? Always has been...

User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Lunokhod » 2017-12-07, 20:42

Back with the new version, and Duolingo open in another tab - no crash so far! It will take some time to prove a negative so I will continue like this for now and see how things go for a day or two.
Wait, it's all Ohio? Always has been...

User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Lunokhod » 2017-12-09, 02:57

Still no problems experienced. :)
Wait, it's all Ohio? Always has been...

User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Re: cubeb_alsa.c:336: alsa_refill_stream

Unread post by Lunokhod » 2017-12-13, 19:58

Still no crashes, despite having had a Duolingo tab open all the time. No unusual error messages either on stdout, and audio works reliably, so the new way of handling this situation does not appear to have any follow on effects, as I would have expected to have seen several crashes by now in the unmodified Pale Moon.
Wait, it's all Ohio? Always has been...

Locked