dnaeon / pvc

Python vSphere Client with a dialog(1) interface
Other
46 stars 13 forks source link

Unexpected crash when switching tabs #5

Closed michaelrice closed 9 years ago

michaelrice commented 9 years ago

If I have tabbed windows and start pvc in window 1, then switch to window 2 pvc will crash

Traceback (most recent call last):
  File "/Users/errr/venvs/pvc/bin/pvc-tui", line 39, in <module>
    main()
  File "/Users/errr/venvs/pvc/bin/pvc-tui", line 36, in main
    app.run()
  File "/Users/errr/venvs/pvc/lib/python3.3/site-packages/pvc/core.py", line 139, in run
    if not self.login():
  File "/Users/errr/venvs/pvc/lib/python3.3/site-packages/pvc/core.py", line 99, in login
    code, fields = form.display()
  File "/Users/errr/venvs/pvc/lib/python3.3/site-packages/pvc/widget/form.py", line 86, in display
    **self.kwargs
  File "/Users/errr/venvs/pvc/lib/python3.3/site-packages/dialog.py", line 2188, in mixedform
    height, width, form_height, **kwargs)
  File "/Users/errr/venvs/pvc/lib/python3.3/site-packages/dialog.py", line 2032, in _generic_form
    (code, output) = self._perform(cmd, **kwargs)
  File "/Users/errr/venvs/pvc/lib/python3.3/site-packages/dialog.py", line 1389, in _perform
    child_output_rfd)
  File "/Users/errr/venvs/pvc/lib/python3.3/site-packages/dialog.py", line 1338, in _wait_for_program_termination
    child_output.strip()))
dialog.DialogError: dialog-like terminated due to an error: the dialog-like program exited with status 3 (which was passed to it as the DIALOG_ERROR environment variable). Sometimes, the reason is simply that dialog was given a height or width parameter that is too big for the terminal in use. Its output, with leading and trailing whitespace stripped, was:

If you need me to explain further let me know. Im currently running OSX and the default terminal app.

dnaeon commented 9 years ago

Have you resized your terminal when using PVC?

The issue itself is not related to PVC, but to the dialog(1) backend and dialog(1) doesn't handle well terminal resize.

There's a bug reported about it here as well:

Unfortunately there is nothing we can do in PVC in order to prevent this as we are just using dialog(1) as the backend for displaying widgets and this should be fixed in dialog(1) itself.

What is the version of dialog(1) that you have installed?

michaelrice commented 9 years ago

@dnaeon Im not resizing but that event could be being sent when switching tabs. Its not too big of a deal I can just run pvc in its own window to work around this as well.

As for dialog version: Version: 1.2-20130928

Since this isnt a bug in pvc please feel free to close it if you want.

Thanks!

dnaeon commented 9 years ago

@michaelrice, could you please test with dialog-1.2-20150225 version and see how it works?

Here are short instructions how to build dialog-1.2-20150225 (just build, not install system-wide) and the needed changes to PVC.

$ tar zxvf dialog.tar.gz
$ cd dialog-1.2-20150225
$ ./configure
$ make
diff --git a/src/pvc/core.py b/src/pvc/core.py
index fdbe9d6..5e10fb5 100644
--- a/src/pvc/core.py
+++ b/src/pvc/core.py
@@ -47,7 +47,7 @@ class MainApp(object):

     """
     def __init__(self):
-        self.dialog = Dialog(autowidgetsize=True)
+        self.dialog = Dialog(autowidgetsize=True, dialog='/path/to/dialog-1.2-20150225/dialog')
         self.dialog.set_background_title(
             'Python vSphere Client version {}'.format(__version__)
         )

Something else that you could try and see if it still crashes is to set autowidgetsize=False in the above diff.

Let me know how it goes, when you have time to test it.

Thanks!

dnaeon commented 9 years ago

@michaelrice, something else that popped up in my mind that I wanted to check with you.

What is your $TERM set to?

dnaeon commented 9 years ago

@michaelrice I've also disabled mouse events for dialog(1), which seems to be causing some issues as well.

I will close this issue as it is not related to PVC itself, please update me when you have time to test the suggestions from this issue and the latest PVC version from the Github repo.

Thanks, Marin