Repository: spyder-ide/spyder

Issue:
Spyder crashes without warning
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [X] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [X] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [X] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [X] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [X] Tried basic troubleshooting (if a bug/error)
    * [X] Restarted Spyder
    * [X] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [X] Tried the other applicable steps from the Troubleshooting Guide
* [X] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

Spyder sometimes randomly crashes when I am using it.  I am typically just editing the text or moving the mouse when this happens, and it doesn't seem to be tied to any particular action.  Without warning, after ~10 or 20 minutes of use, the Spyder terminal disappears and I get the following message in the Linux terminal:

srun: error: cn43: task 0: Aborted (core dumped)

"spyder --reset" seems to help for a little while, but the problem eventually returns.  Creating a new conda environment also seems to help for a while, but the problem eventually returns.  I have not reinstalled Anaconda because I am using a central Anaconda installation made by the people overseeing the computing resources at my university.

I have had issues with spyder and pyqt on this system before, but not for a while.

### What steps reproduce the problem?

1. Start spyder with a command like: srun --x11 -c 1 --time=1:00:00 --mem=10000 spyder &
2. Use Spyder for a little while.
3. Sometimes, without warning, Spyder crashes.

### What is the expected output? What do you see instead?

Expected: Spyder continues to work.
Actual: The Spyder window closes without warning.  The changes since my last save aren't saved, and when I reload, the files that I had loaded during the last session aren't loaded.

### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

Python crashes without providing traceback.  However, I outputted some debug info and pasted the last 100 lines of one of the crashes below.

```
2021-02-22 10:36:08,055 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 190 removed
2021-02-22 10:36:08,055 [DEBUG] [spyder.plugins.completion.plugin] -> Gather responses for textDocument/foldingRange
2021-02-22 10:36:08,057 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 191 Got response from lsp
2021-02-22 10:36:08,057 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 191 removed
2021-02-22 10:36:08,057 [DEBUG] [spyder.plugins.completion.plugin] -> Gather responses for textDocument/documentSymbol
2021-02-22 10:36:08,065 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 192 timed out
2021-02-22 10:36:08,065 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 193 timed out
2021-02-22 10:36:08,065 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 194 timed out
2021-02-22 10:36:08,065 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 195 timed out
2021-02-22 10:36:08,065 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 196 timed out
2021-02-22 10:36:08,065 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 197 timed out
2021-02-22 10:36:08,065 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 198 timed out
2021-02-22 10:36:08,367 [DEBUG] [spyder.plugins.completion.languageserver.client] -> python response: textDocument/publishDiagnostics
2021-02-22 10:36:08,368 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/foldingRange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:08,368 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/foldingRange with id 169
2021-02-22 10:36:08,368 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 199 Got response from kite
2021-02-22 10:36:08,368 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/documentSymbol for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:08,368 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/documentSymbol with id 170
2021-02-22 10:36:08,368 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 200 Got response from kite
2021-02-22 10:36:08,370 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/foldingRange with id 199
2021-02-22 10:36:08,370 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/documentSymbol with id 200
2021-02-22 10:36:08,589 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/didChange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:08,589 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/didChange with id 171
2021-02-22 10:36:08,589 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 201 Got response from kite
2021-02-22 10:36:08,592 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (84): 127.0.0.1:46624
2021-02-22 10:36:08,593 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/didChange with id 201
2021-02-22 10:36:08,942 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 199 Got response from lsp
2021-02-22 10:36:08,942 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 199 removed
2021-02-22 10:36:08,942 [DEBUG] [spyder.plugins.completion.plugin] -> Gather responses for textDocument/foldingRange
2021-02-22 10:36:08,944 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 200 Got response from lsp
2021-02-22 10:36:08,944 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 200 removed
2021-02-22 10:36:08,944 [DEBUG] [spyder.plugins.completion.plugin] -> Gather responses for textDocument/documentSymbol
2021-02-22 10:36:08,953 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 201 timed out
2021-02-22 10:36:08,953 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/didChange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:08,953 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/didChange with id 172
2021-02-22 10:36:08,953 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 202 Got response from kite
2021-02-22 10:36:08,954 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/didChange with id 202
2021-02-22 10:36:09,923 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/didChange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:09,923 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/didChange with id 173
2021-02-22 10:36:09,923 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 203 Got response from kite
2021-02-22 10:36:09,925 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/didChange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:09,925 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/didChange with id 174
2021-02-22 10:36:09,925 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 204 Got response from kite
2021-02-22 10:36:09,927 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/didChange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:09,928 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/didChange with id 175
2021-02-22 10:36:09,928 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 205 Got response from kite
2021-02-22 10:36:09,930 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/didChange with id 203
2021-02-22 10:36:09,930 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/didChange with id 204
2021-02-22 10:36:09,930 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/didChange with id 205
2021-02-22 10:36:09,931 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (85): 127.0.0.1:46624
2021-02-22 10:36:09,933 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (86): 127.0.0.1:46624
2021-02-22 10:36:09,936 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (87): 127.0.0.1:46624
2021-02-22 10:36:10,205 [DEBUG] [spyder.plugins.completion.languageserver.client] -> python response: textDocument/publishDiagnostics
2021-02-22 10:36:10,205 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/foldingRange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:10,205 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/foldingRange with id 176
2021-02-22 10:36:10,205 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 206 Got response from kite
2021-02-22 10:36:10,205 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/documentSymbol for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:10,205 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/documentSymbol with id 177
2021-02-22 10:36:10,205 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 207 Got response from kite
2021-02-22 10:36:10,208 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/foldingRange with id 206
2021-02-22 10:36:10,208 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/documentSymbol with id 207
2021-02-22 10:36:10,219 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 202 timed out
2021-02-22 10:36:10,219 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 203 timed out
2021-02-22 10:36:10,219 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 204 timed out
2021-02-22 10:36:10,219 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 205 timed out
2021-02-22 10:36:10,710 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/didChange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:10,710 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/didChange with id 178
2021-02-22 10:36:10,710 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 208 Got response from kite
2021-02-22 10:36:10,713 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/didChange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:10,713 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/didChange with id 179
2021-02-22 10:36:10,713 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 209 Got response from kite
2021-02-22 10:36:10,716 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/didChange with id 208
2021-02-22 10:36:10,716 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/didChange with id 209
2021-02-22 10:36:10,718 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (88): 127.0.0.1:46624
2021-02-22 10:36:10,720 [DEBUG] [urllib3.connectionpool] -> Starting new HTTP connection (89): 127.0.0.1:46624
2021-02-22 10:36:11,590 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 206 Got response from lsp
2021-02-22 10:36:11,590 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 206 removed
2021-02-22 10:36:11,590 [DEBUG] [spyder.plugins.completion.plugin] -> Gather responses for textDocument/foldingRange
2021-02-22 10:36:11,593 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 207 Got response from lsp
2021-02-22 10:36:11,593 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 207 removed
2021-02-22 10:36:11,593 [DEBUG] [spyder.plugins.completion.plugin] -> Gather responses for textDocument/documentSymbol
2021-02-22 10:36:11,599 [DEBUG] [spyder.plugins.completion.languageserver.client] -> python response: textDocument/publishDiagnostics
2021-02-22 10:36:11,599 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/foldingRange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:11,599 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/foldingRange with id 180
2021-02-22 10:36:11,599 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 210 Got response from kite
2021-02-22 10:36:11,599 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/documentSymbol for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:11,600 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/documentSymbol with id 181
2021-02-22 10:36:11,600 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 211 Got response from kite
2021-02-22 10:36:11,627 [DEBUG] [spyder.plugins.completion.languageserver.client] -> python response: textDocument/publishDiagnostics
2021-02-22 10:36:11,627 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/foldingRange for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
2021-02-22 10:36:11,627 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/foldingRange with id 182
2021-02-22 10:36:11,627 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 212 Got response from kite
2021-02-22 10:36:11,628 [DEBUG] [spyder.plugins.editor.plugin] -> Perform request textDocument/documentSymbol for: /home/mpe32/analysis/15_Holocene_Reconstruction/analyze_results/06_pseudoproxy_experiments/5_nh_sh_pseudo.py
QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/637675', please create it with 0700 permissions.
QThread: Destroyed while thread is still running
2021-02-22 10:36:11,627 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/foldingRange with id 210
2021-02-22 10:36:11,628 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/documentSymbol with id 211
2021-02-22 10:36:11,628 [DEBUG] [spyder.plugins.completion.snippets.actor] -> Perform request textDocument/foldingRange with id 212
2021-02-22 10:36:11,628 [DEBUG] [spyder.plugins.completion.languageserver.client] -> Perform request textDocument/documentSymbol with id 183
2021-02-22 10:36:11,628 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Request 213 Got response from kite

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.2.1
* Python version: 3.8.5 64-bit
* Qt version: 5.9.7
* PyQt version: 5.9.2
* Operating System name/version: Linux 4.18.0-193.28.1.el8_2.x86_64 

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
# Mandatory:
atomicwrites >=1.2.0            :  1.4.0 (OK)
chardet >=2.0.0                 :  4.0.0 (OK)
cloudpickle >=0.5.0             :  1.6.0 (OK)
diff_match_patch >=20181111     :  20200713 (OK)
intervaltree >=3.0.2            :  3.1.0 (OK)
IPython >=7.6.0                 :  7.20.0 (OK)
jedi =0.17.2                    :  0.17.2 (OK)
jsonschema >=3.2.0              :  3.2.0 (OK)
keyring >=17.0.0                :  22.0.1 (OK)
nbconvert >=4.0                 :  6.0.7 (OK)
numpydoc >=0.6.0                :  1.1.0 (OK)
parso =0.7.0                    :  0.7.0 (OK)
pexpect >=4.4.0                 :  4.8.0 (OK)
pickleshare >=0.4               :  0.7.5 (OK)
psutil >=5.3                    :  5.8.0 (OK)
pygments >=2.0                  :  2.8.0 (OK)
pylint >=1.0                    :  2.6.0 (OK)
pyls >=0.36.2;<1.0.0            :  0.36.2 (OK)
pyls_black >=0.4.6              :  0.4.6 (OK)
pyls_spyder >=0.3.0             :  0.3.2 (OK)
qdarkstyle >=2.8                :  2.8.1 (OK)
qtawesome >=0.5.7               :  1.0.1 (OK)
qtconsole >=5.0.1               :  5.0.2 (OK)
qtpy >=1.5.0                    :  1.9.0 (OK)
rtree >=0.8.3                   :  0.9.4 (OK)
setuptools >=39.0.0             :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                  :  3.4.3 (OK)
spyder_kernels >=1.10.1;<1.11.0 :  1.10.1 (OK)
textdistance >=4.2.0            :  4.2.1 (OK)
three_merge >=0.1.1             :  0.1.1 (OK)
watchdog >=0.10.3               :  1.0.2 (OK)
xdg >=0.26                      :  0.27 (OK)
zmq >=17                        :  20.0.0 (OK)

# Optional:
cython >=0.21                   :  0.29.21 (OK)
matplotlib >=2.0.0              :  3.3.4 (OK)
numpy >=1.7                     :  1.19.2 (OK)
pandas >=1.1.1                  :  1.2.2 (OK)
scipy >=0.17.0                  :  1.6.0 (OK)
sympy >=0.7.3                   :  None (NOK)
```



Discussion:
Hey @michaelerb, thanks for reporting. Unfortunately, we don't have a way to test Spyder in a Slurm cluster, so there's little we can do to help you debug this. That could be the problem because I've used Spyder on Linux for weeks without a crash.

You also said

> Python crashes without providing traceback. However, I outputted some debug info and pasted the last 100 lines of one of the crashes below.

Since this is a hard crash, please start Spyder with the following command

     srun --x11 -c 1 --time=1:00:00 --mem=10000 spyder --report-segfault &

and after the crash please start it again with the same command. That will open a window that contains information about the crash and could help us to fix it.

To get that info, please click on the "Show details" button of that window and copy the displayed contents here:

![imagen](https://user-images.githubusercontent.com/365293/108789556-84245200-7548-11eb-9971-be374f9dee45.png)

Hi ccordoba,

I followed your suggestion.  After Spyder crashed and I restarted it, I got the following text:

```
Fatal Python error: Aborted

Thread 0x0000153a49df0700 (most recent call first):
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 306 in wait
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 558 in wait
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/jupyter_client/channels.py", line 161 in run
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x0000153a4a433700 (most recent call first):
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/selectors.py", line 468 in select
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/asyncio/base_events.py", line 1823 in _run_once
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/asyncio/base_events.py", line 570 in run_forever
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 199 in start
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/jupyter_client/threaded.py", line 187 in run
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x0000153a4aab6700 (most recent call first):
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 302 in wait
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 558 in wait
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/IPython/core/history.py", line 829 in run
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/IPython/core/history.py", line 58 in needs_sqlite
  File "<decorator-gen-17>", line 2 in run
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x0000153a9c506700 (most recent call first):
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/socket.py", line 292 in accept
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 3156 in start_open_files_server
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 870 in run
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x0000153ad3d7b740 (most recent call first):
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/plugins/editor/widgets/codeeditor.py", line 2835 in process_code_analysis
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/plugins/editor/widgets/codeeditor.py", line 1280 in process_diagnostics
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/plugins/editor/widgets/codeeditor.py", line 1095 in handle_response
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/plugins/completion/languageserver/providers/document.py", line 41 in process_document_diagnostics
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/plugins/completion/languageserver/client.py", line 522 in on_msg_received
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 3529 in create_window
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 3628 in main
  File "/projects/pd_lab/mpe32/conda/envs/python3/lib/python3.8/site-packages/spyder/app/start.py", line 214 in main
  File "/projects/pd_lab/mpe32/conda/envs/python3/bin/spyder", line 11 in <module>
```

Does this mean anything to you?
Sorry, I don't see any possible cause for the crash on that error message.
Hmm.  I'm not 100% sure, but it seems to crash shortly after I copy/paste.  Is there anything about copy/pasting text (with ctrl-c/ctrl-v) that might explain this behavior?
People reported that Spyder freezes when you try to paste large amounts of text in the editor. Is that the case for you?
No, Spyder isn't freezing.  It just crashes (the entire window disappears instantly).  And the amount of text is often relatively small.  However, I'm not sure if the copy/pasting has anything to do with the crashing.  I think sometimes the crashing occurs without any copy/pasting.
I have a theory:
The crashing line is: https://github.com/spyder-ide/spyder/blob/9c84cd89625d9ad07f54810588ae6464fa4efef1/spyder/plugins/editor/widgets/codeeditor.py#L2835
What might happen is that if the thread is still running when `process_code_analysis` is called, the prevous thread object might be deleted by python as the reference count falls to zero, causing the crash.
We could test that by:
 - adding `self.update_diagnostics = None` in `__init__`
 - adding `if self.update_diagnostics.isRunning(): self.update_diagnostics.wait(1000)` to make sure the thread is not running when deleted.

@michaelerb Could you test if that gets rid of the crash?
This is a very good theory @impact27! Have you tried to reproduce this crash yourself?
@ccordoba12 I am not on linux so I can't really test that.
Ok, but if your hunch is right, the crash should be reproducible in any OS. 
Thanks for the suggestions.  For now, I've just gone back to Spyder 3.3.6, which has been working fine.
Similar problem here: spyder just crashes randomly, with the following error: "Aborted (core dumped)". I am using spyder 4.2.3 installed with conda, on Ubuntu 18.04. I completely removed Anaconda, re-installed it and then re-installed spyder with conda. For a few days, there were no crashes anymore. But now it's back to the old behaviour: a crash after typically a few minutes of usage. Is there a way I can provide more information? Or verify that this is the same issue? I tried the srun command suggested by ccordoba12, but I was unable to get slurm running.

@gica3618  if you run spyder with `--report-segfault` it will collect more information on the crash. After a crash, launch spyder with `--report-segfault` and it will open a windows with the trackback.
I can make spyder crash by increasing the thread time:
```
    def set_errors(self):
        """Set errors and warnings in the line number area."""
        self._process_code_analysis(underline=False)
        import time
        time.sleep(10)
```


Resolving patch:
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -677,6 +677,10 @@ def __init__(self, parent=None):
         self.is_undoing = False
         self.is_redoing = False
 
+        # Diagnostics
+        self.update_diagnostics = None
+        self.restart_diagnostics = None
+
     # --- Helper private methods
     # ------------------------------------------------------------------------
 
@@ -1296,6 +1300,13 @@ def sync_symbols_and_folding(self):
 
     def process_code_analysis(self, diagnostics):
         """Process code analysis results in a thread."""
+        if (self.update_diagnostics is not None
+                and self.update_diagnostics.isRunning()):
+            self.restart_diagnostics = diagnostics
+            return
+
+        self.restart_diagnostics = None
+
         self.cleanup_code_analysis()
         self._diagnostics = diagnostics
 
@@ -1349,6 +1360,8 @@ def finish_code_analysis(self):
         self.update_extra_selections()
         self.sig_process_code_analysis.emit()
         self.sig_flags_changed.emit()
+        if self.restart_diagnostics is not None:
+            self.process_code_analysis(self.restart_diagnostics)
 
     def _process_code_analysis(self, underline):
         """


Test patch: