Spyder: Spyder crashes when pressing ctrl-g in editor to go to definition

Created on 10 Jan 2017  路  27Comments  路  Source: spyder-ide/spyder

Description of your problem

About half the times when pressing ctrl-g in the Spyder editor to go to definition, spyder/python crashes.
What steps will reproduce the problem?

  1. Open a python file in the Spyder editor
  2. Move the caret to a function or any other object defined in another file
  3. Press CTRL-G (or right click and select go to definition in the pop-up menu)

What is the expected output? What do you see instead?
Program crashes

Please provide any additional information below

Versions and main components

  • Spyder Version: 3.0.2
  • Python Version: Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
  • Operating system: Windows 10

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:
jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 1.5.3 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.1 (OK)
pandas >=0.13.1 : 0.18.1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
pyflakes >=0.6.0 : 1.3.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.5.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.4.6 (OK)
sympy >=0.7.3 : 1.0 (OK)

Editor Bug

Most helpful comment

@ccordoba12 @goanpeca
The problem occurs in the PluginManager where response from rope and jedi for a same request are _sometimes_ allowed to pass through to the IntrospectionManager, resulting in almost two simulatenous command to open the same file when it is not already opened in Spyder and a crash.

Could you please try to switch line #146 with line #147 in the PluginManager and tell me if it is still crashing on your end. For me, it seemed to have fixed completely the problem.

    def _finalize(self, response):
        self.waiting = False
        self.pending = None
        if self.info:
            delta = time.time() - self._start_time
            debug_print('%s request from %s finished: "%s" in %.1f sec'
                % (self.info.name, response['name'],
                   str(response['result'])[:100], delta))
            response['info'] = self.info
            self.info = None
            self.introspection_complete.emit(response)            
        if self.pending_request:
            info = self.pending_request
            self.pending_request = None
            self.send_request(info)

All 27 comments

@andfoy, please take a look at this one.

@oriori @ccordoba12 Can we have more information about the crashes? I've tried all kind of possible references offered by Python (Classes, Functions and Variables) in local files as in libraries and builtins, but I couldn't reproduce the error. Is it a Segmentation Fault error?

Did you use the exact same configuration of @oriori? Windows 10 seems relevant here :-)

Well, the console reports this Warning just before crashing:

QWindowsWindow::setGeometry: Unable to set geometry 1260x1442+18+41 on QWidgetWindow/'MainWindowClassWindow'. Resulting
geometry:  1260x716+18+41 (frame: 8, 31, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 418x716, maximum size: 16777215x
16777215).

So were you able to reproduce this problem?

Yes I could reproduce the problem, the current settings correspond to:

Version and main components

  • Spyder Version: 3.1.0.dev0 97b5b5a1
  • Python Version: Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
  • Qt Versions: 5.6.0, PyQt5 5.6 on Windows
  • Windows Version: Windows 10

Dependencies

jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 1.5.3 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.1 (OK)
pandas >=0.13.1 : 0.18.1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
pyflakes >=0.6.0 : 1.3.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.5.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.4.6 (OK)
sympy >=0.7.3 : 1.0 (OK)

Ok, good, thanks for doing it.

Could you update qt and pyqt with this command

conda update qt pyqt

and try again?

Note: The warning you reported is harmless. I've seen it too.

The error occurs randomly, and it seems to take place in Windows, I've tried to reproduce it in Ubuntu without any success. I will update the Qt dependencies and try again.

I did update the dependencies. After evaluating the functionality about 30 times with different local and builtin functions, variables and classes, the program crashed unexpectedly again

This is the crash log associated:

Faulting application name: python.exe, version: 3.5.2150.1013, time stamp: 0x577be340
Faulting module name: Qt5Core.dll, version: 5.6.2.0, time stamp: 0x5835ef42
Exception code: 0xc0000005

_Update:_ It seems that this error is related to a Memory Access Violation

I also got a crash report due to an error in module ucrtbase.dll

Faulting application name: python.exe, version: 3.5.2150.1013, time stamp: 0x577be340
Faulting module name: ucrtbase.dll, version: 10.0.14393.0, time stamp: 0x578997b5
Exception code: 0xc0000409

_Update:_ It seems that this error is related to an Stack Overrun

I am still getting this issue on Windows 10, with Spyder 3.1.3.

Still has this issue in ubuntu 16.04, with annoconda3.6 and the spyder version is 3.1.3.

It is often crash when I use ctrl to enter some definition or function which imported from other packages such as nmpy and tensorflow.

I have already closed the real-time code analysis and something else but its seem no uses. I haven't seen any error message it just crashed.

jedi =0.9.0 : 0.9.0 (OK)
matplotlib >=1.0 : 2.0.0 (OK)
nbconvert >=4.0 : 5.1.1 (OK)
numpy >=1.7 : 1.11.3 (OK)
pandas >=0.13.1 : 0.19.2 (OK)
pep8 >=0.6 : 1.7.0 (OK)
psutil >=0.3 : 5.1.3 (OK)
pyflakes >=0.6.0 : 1.5.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.6.5 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.5.2 (OK)
sympy >=0.7.3 : 1.0 (OK)

If feels like it only crashes when I try to open a file that was not open before.

What do you mean?

Yes!, I have seen this happen.

If you have an open file on the editor (filea.py)

# filea.py

from fileb import some_method

def other_method(*args):
    return some_method(*args)

But fileb.py is closed

If you do Ctrl+some_method on the open filea.py it will attempt to open fileb.py and at that moment it crashes

I am not sure but I think I only get crashes if the definition I go to is not in a file that is open in a tab.
If I use a debugger, the last state of the GUI before crashing is a new tab with the correct file and the cursor on the correct line.

@goanpeca, great!! At last a reproducible case :-)

@ccordoba12

Hi, I just find a reproducible case about this issue in spyder 3.1.3.

When I to go to definition into the sum the spyder crashed everytime. I try it both in Ubuntu and windows.

Try to press CTRL-G on this:

sum([1,2,3])

Same as @impact27 , I can consistently reproduce this if fileb.py is not in tab, and consistently avoid it if I preopen fileb.py before pressig CTRL-G (or CTRL+Left Click).

spyder 3.1.4 on Windows 10 with Python 3.5.2 64 bits, Qt 5.6.2, PyQt5 5.6

The crash also occurs in Windows 7 64 bits with PyQt4 and Python 3.3 through 3.6. If I recall, I think I first noticed this crash for the first time somewhere in the 2.x series on Ubuntu, but I'm not sure.

@ccordoba12 @goanpeca
The problem occurs in the PluginManager where response from rope and jedi for a same request are _sometimes_ allowed to pass through to the IntrospectionManager, resulting in almost two simulatenous command to open the same file when it is not already opened in Spyder and a crash.

Could you please try to switch line #146 with line #147 in the PluginManager and tell me if it is still crashing on your end. For me, it seemed to have fixed completely the problem.

    def _finalize(self, response):
        self.waiting = False
        self.pending = None
        if self.info:
            delta = time.time() - self._start_time
            debug_print('%s request from %s finished: "%s" in %.1f sec'
                % (self.info.name, response['name'],
                   str(response['result'])[:100], delta))
            response['info'] = self.info
            self.info = None
            self.introspection_complete.emit(response)            
        if self.pending_request:
            info = self.pending_request
            self.pending_request = None
            self.send_request(info)

@jnsebgosselin, you're our hero!! I've also seen this problem on Linux and was wondering what was causing it. However, it doesn't generate a crash there.

Unfortunately neither @goanpeca nor me use Windows, so could you create a PR so that @andfoy (who was able to reproduce this problem on his end) can test it?

Again, thanks a lot for helping us with this one!!

I tried to apply the fix, and it made the crash never occur on my environment (Windows 10 64 bit, python 3.6.1, Spyder 3.1.3)
Thank you @jnsebgosselin.

jedi =0.9.0 : 0.9.0 (OK)
matplotlib >=1.0 : 2.0.2 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.13.0 (OK)
pandas >=0.13.1 : 0.19.2 (OK)
pep8 >=0.6 : 1.5.7 (OK)
pyflakes >=0.6.0 : 1.5.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.6.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.5.6 (OK)
sympy >=0.7.3 : 1.0 (OK)

@ronekko, thanks for helping us to test @jnsebgosselin fix.

@ccordoba12 Congratulations for your 3.2 release 馃憤 :) !

Thanks!

Was this page helpful?
0 / 5 - 0 ratings