Closed ZLLentz closed 4 years ago
That's a new one to me.
Could not parse stylesheet of object QLabel(0x55f00b0f65a0, name = "state_label")
Looks like it may be related to: https://github.com/pcdshub/lightpath/blob/415410dfa810af825337580c437409b51b6a416d/lightpath/ui/widgets.py#L30-L35
Yeah you're right, that's definitely the culprit... But why? Hmm.
If this happens at all again during testing or operations I'm just removing that line. For now I proceed to fixing various device implementation issues.
A different crash, just going to start logging them here I guess... This one happened when I clicked the "hide removed devices" button, and then clicked it again to bring the devices back.
Just kidding, it had the same source. I'm killing the QLabel styler.
Actually, this one is pretty important for the screen to look right... might deserve a closer look
I've been trying to reproduce this in isolation (that is, setting a similar stylesheet on a QLabel), but haven't had it crash yet... ~Is this the dev environment?~ I see /reg/neh/home/zlentz/miniconda3/envs/dev
I can't reproduce it myself either. I slapped a print statement in there, jammed all the buttons... nothing. Waited a bit and got this:
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
QLabel {color: rgb(124, 252, 0)}
Segmentation fault
Probably sign to take a break
(My test for future reference was /reg/neh/home5/klauer/Repos/lightpath/style.py
)
Based on your results and my test, it seems like it's not the stylesheet itself, but rather what's happening around it (leaked resource/double free/etc?). Hmmm...
I was taking a quick look at it and I noticed a couple of things:
update_state
is being called from a signal subscription, right? Is there any chance that this may happen outside of the main UI thread?Sorry that this does not provide a clear path or answer but it is at least it is something to look into.
Bad stylesheets are fine and one example of this is that the Vacuum screens had invalid stylesheets for a while. You should only get a warning from Qt.
should only get a warning doesn't mean much, sadly.
But your other point appears correct - this is being called in an ophyd subscription, which is certainly not in a GUI thread. The subscription should be switched into subscribe(lambda **kwargs: some_signal.emit()); some_signal.connect(self.update_state)
or something similar, which should hopefully fix it.
That makes sense to me. Certainly this is the first thing to try, I'll give it a go.
It makes me uneasy to have these things where "you're doing it wrong every time but it only occasionally crashes". I'd much prefer a python exception from the upstream library when I'm doing it wrong.
The screen has stayed open for 2.5 hours now with no segfaults after implementing the above fix. If it is still up when I stop for today I will close this issue.
Seems stable to me! Will re-open if I see the same crashes, will open a new issue if I see different ones. Thanks for the help!
Various occasional segfaults, and today this spewed into my terminal: