Skip to content

Commit

Permalink
Added "manual override" to get DreamPie out of its stuck state.
Browse files Browse the repository at this point in the history
The problem seems to be due to the _n_unclaimed_results counter somehow getting out of sync.
At some point, this counter is incremeneted but not properly decremented.
The result is that DreamPie keeps saying "subprocess is busy", thinking it is waiting for a result, but there really isn't any result coming, so it waits forever.
(This waiting occurs in DreamPie.call_subp_noblock, which is called from execute_source.)

The "solution" is to add a simple method to the DreamPie class that just decrements _n_unclaimed_results.
I then added a menu item to call this function.
If this "stuck" situation arises, you can clear it by using this manual override.
Note that using this when the subprocess is *not* stuck could cause havoc, so be careful!
  • Loading branch information
BrenBarn committed Oct 13, 2016
1 parent d288e7e commit cd59da4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dreampielib/data/dreampie.glade
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,17 @@ You can also set the __expects_str__ attribute of a function to True to achieve
<accelerator key="F6" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem_unclog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip" translatable="yes">Try to unclog a stuck subprocess. Use with care!</property>
<property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Unclog subprocess</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_unclog_subprocess"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem_clear_reshist">
<property name="visible">True</property>
Expand Down
10 changes: 10 additions & 0 deletions dreampielib/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,16 @@ def on_interrupt(self, _widget):
_("A command isn't being executed currently"))
beep()

def on_unclog_subprocess(self, _widget):
# It seems that sometimes DreamPie thinks there is an unclaimed
# result when there really isn't. Here we try to clear the clog by
# decrementing the unclaimed result counter. This could blow up
# badly if used at the wrong time, so should only be used when it
# really seems like DreamPie thinks the subprocess is busy but it
# really isn't.
self._n_unclaimed_results -= 1


# History persistence

def on_save_history(self, _widget):
Expand Down

0 comments on commit cd59da4

Please sign in to comment.