Repository: spyder-ide/spyder

Issue:
TimeoutError: Timeout while waiting for comm port
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

I upgraded through the Anaconda dashboard the Spyder platform
from 4.0.1 to 4.1.0, and immediately after starting this message
appeared. The Anaconda dashboard had upgraded itself just before.

### Traceback
```python-traceback
  File "C:\Users\Giovanni\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\plugin.py", line 547, in set_current_client_working_directory
    shellwidget.set_cwd(directory)
  File "C:\Users\Giovanni\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\shell.py", line 178, in set_cwd
    self.call_kernel(interrupt=True).set_cwd(dirname)
  File "C:\Users\Giovanni\Anaconda3\lib\site-packages\spyder_kernels\comms\commbase.py", line 538, in __call__
    call_dict, call_data, self._comm_id)
  File "C:\Users\Giovanni\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 130, in _get_call_return_value
    with self.comm_channel_manager(comm_id, queue_message=not interrupt):
  File "C:\Users\Giovanni\Anaconda3\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\Giovanni\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 87, in comm_channel_manager
    timeout)
  File "C:\Users\Giovanni\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\comms\kernelcomm.py", line 168, in _wait
    raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for comm port.
```

## Versions

* Spyder version: 4.1.0 
* Python version: 3.7.1
* Qt version: 5.12.5
* PyQt5 version: 5.12.3
* Operating System: Windows 10

### Dependencies

```

# Mandatory:
atomicwrites >=1.2.0           :  1.3.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.2.2 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.11.1 (OK)
jedi =0.14.1                   :  0.14.1 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
paramiko >=2.4.0               :  2.7.1 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.7.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.6.7 (OK)
pygments >=2.0                 :  2.5.2 (OK)
pylint >=0.25                  :  2.4.4 (OK)
pyls >=0.31.2;<0.32.0          :  0.31.4 (OK)
qdarkstyle >=2.8               :  2.8 (OK)
qtawesome >=0.5.7              :  0.6.1 (OK)
qtconsole >=4.6.0              :  4.6.0 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.3 (OK)
sphinx >=0.6.6                 :  2.3.1 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  3.1.2 (OK)
numpy >=1.7                    :  1.17.3 (OK)
pandas >=0.13.1                :  0.24.2 (OK)
scipy >=0.17.0                 :  1.3.1 (OK)
sympy >=0.7.3                  :  None (OK)
```



Discussion:

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/comms/kernelcomm.py b/spyder/plugins/ipythonconsole/comms/kernelcomm.py
--- a/spyder/plugins/ipythonconsole/comms/kernelcomm.py
+++ b/spyder/plugins/ipythonconsole/comms/kernelcomm.py
@@ -80,7 +80,7 @@ def comm_channel_manager(self, comm_id, queue_message=False):
         if not self.comm_channel_connected():
             # Ask again for comm config
             self.remote_call()._send_comm_config()
-            timeout = 10
+            timeout = 45
             self._wait(self.comm_channel_connected,
                        self._sig_channel_open,
                        "Timeout while waiting for comm port.",
@@ -146,7 +146,7 @@ def _wait(self, condition, signal, timeout_msg, timeout):
         Wait until condition() is True by running an event loop.
 
         signal: qt signal that should interrupt the event loop.
-        timeout_msg: Meaage to display in case of a timeout.
+        timeout_msg: Message to display in case of a timeout.
         timeout: time in seconds before a timeout
         """
         if condition():
diff --git a/spyder/plugins/ipythonconsole/plugin.py b/spyder/plugins/ipythonconsole/plugin.py
--- a/spyder/plugins/ipythonconsole/plugin.py
+++ b/spyder/plugins/ipythonconsole/plugin.py
@@ -1217,7 +1217,7 @@ def create_kernel_manager_and_kernel_client(self, connection_file,
 
         # Increase time to detect if a kernel is alive.
         # See spyder-ide/spyder#3444.
-        kernel_client.hb_channel.time_to_dead = 18.0
+        kernel_client.hb_channel.time_to_dead = 45.0
 
         return kernel_manager, kernel_client
 


Test patch: