Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
oriori opened this issue Jan 10, 2017 · 27 comments
Closed

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

oriori opened this issue Jan 10, 2017 · 27 comments
Assignees
Milestone

Comments

@oriori
Copy link

oriori commented Jan 10, 2017

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)

@ccordoba12
Copy link
Member

@andfoy, please take a look at this one.

@andfoy
Copy link
Member

andfoy commented Jan 10, 2017

@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?

@ccordoba12
Copy link
Member

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

@andfoy
Copy link
Member

andfoy commented Jan 11, 2017

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).

@ccordoba12
Copy link
Member

So were you able to reproduce this problem?

@andfoy
Copy link
Member

andfoy commented Jan 11, 2017

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

Version and main components

  • Spyder Version: 3.1.0.dev0 97b5b5a
  • 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)

@ccordoba12
Copy link
Member

ccordoba12 commented Jan 11, 2017

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.

@andfoy
Copy link
Member

andfoy commented Jan 11, 2017

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.

@andfoy
Copy link
Member

andfoy commented Jan 11, 2017

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

@andfoy
Copy link
Member

andfoy commented Jan 11, 2017

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

@andfoy
Copy link
Member

andfoy commented Jan 11, 2017

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

@bzm3r
Copy link

bzm3r commented Feb 23, 2017

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

@CKboss
Copy link

CKboss commented Feb 24, 2017

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)

@impact27
Copy link
Contributor

impact27 commented Apr 5, 2017

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

@ccordoba12
Copy link
Member

What do you mean?

@goanpeca
Copy link
Member

goanpeca commented Apr 5, 2017

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

@impact27
Copy link
Contributor

impact27 commented Apr 5, 2017

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.

@ccordoba12
Copy link
Member

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

@CKboss
Copy link

CKboss commented Apr 19, 2017

@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])

@ccordoba12 ccordoba12 modified the milestones: v3.2, v3.2.1 Apr 26, 2017
@erwanp
Copy link

erwanp commented Jun 4, 2017

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

@jnsebgosselin
Copy link
Member

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.

@jnsebgosselin
Copy link
Member

@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)

@ccordoba12
Copy link
Member

@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!!

@ronekko
Copy link

ronekko commented Jul 21, 2017

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)

@ccordoba12
Copy link
Member

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

@sebma
Copy link

sebma commented Aug 2, 2017

@ccordoba12 Congratulations for your 3.2 release 👍 :) !

@ccordoba12
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests