# Remote kernel shuts down after several seconds

**URL:** <https://community.wolfram.com/t/remote-kernel-shuts-down-after-several-seconds/1553>\
**Category:** Questions\
**Tags:** mathematica, external-interfaces, tuning-and-debugging\
**Created:** [February 20, 2014, 8:20am UTC](https://community.wolfram.com/t/remote-kernel-shuts-down-after-several-seconds/1553 "2014-02-20T08:20:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbir](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@paulbir](https://community.wolfram.com/u/paulbir)\
**Post date:** [February 20, 2014, 8:20am UTC](https://community.wolfram.com/t/remote-kernel-shuts-down-after-several-seconds/1553/1 "2014-02-20T08:20:29Z")

</div>

I have problems with using remote kernels.  
I have Mathematica 9 installed on two Windows Server 2008 R2 machines. Now i want to try using one of them as a frontend with local kernels and the other one for remote kernels.  
OpenSSH 6.5 for Windows is installed on both machines and key authentication is configured without a passphrase. SSH connection works normally.

Here is the frontend configuration. In Preferences → Parallel → Remote Kernels i Add Host and use the custom launch command:

```auto
ssh -f -n user@remote_ip c:/progra~1/wolfra~1/mathematica/9.0/math -mathlink -linkmode Connect -linkprotocol TCPIP -linkname 'some_port@local_ip,some_port2@local_ip' -subkernel -noinit

```

For test purposes i set 2 remote and 2 local kernels in settings. After that in the notebook i try to call:

```auto
Parallel`Settings`$MathLinkTimeout = 40
LaunchKernels[]

```

and launch Task Manager on both machines. At first two cmd windows appear and instantly close. Then i can see that two MathKernel.exe processes start on loca lmachine and math.exe processes start on remote machine, but after nearly 20 seconds remote processes shut down. Local kernels stay running. After timeout i see an error output.

```auto
SubKernels`Protected`kernelFlush::time: Operation LinkWrite timed out after 40 seconds.
KernelObject::rdead: Subkernel connected through remote[remote_ip] appears dead. >>
SubKernels`Protected`kernelFlush::time: Operation LinkWrite timed out after 40 seconds.
KernelObject::rdead: Subkernel connected through remote[remote_ip] appears dead. >>
Out[9]= {KernelObject[7,local],KernelObject[8,local],$Failed,$Failed}

```

I tried [this solution](https://wolfram.discourse.group/t/367/1) . It works, so it’s not a problem of connection or firewall.  
When i try to run ssh command in the command line, math.exe starts on remote machine and then closes itself. After that on the local machine in the command line i see this message:

```auto
LinkConnect::linkc:
-- Message text not found -- (
LinkObject[some_port@local_ip,some_port2@local_ip, 3, 1])

```

Thanks beforehand. A solution would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![brucem](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/brucem/32/26319_2.png) [@brucem](https://community.wolfram.com/u/brucem)\
**Post date:** [February 20, 2014, 11:05pm UTC](https://community.wolfram.com/t/remote-kernel-shuts-down-after-several-seconds/1553/2 "2014-02-20T23:05:01Z")

</div>

Just to make it explicit, does Mathematica with local kernels work fine on both machines?

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/szhorvat/32/3531_2.png) [@szhorvat](https://community.wolfram.com/u/szhorvat)\
**Post date:** [February 21, 2014, 3:33am UTC](https://community.wolfram.com/t/remote-kernel-shuts-down-after-several-seconds/1553/3 "2014-02-21T03:33:50Z")

</div>

[Cross linking with SE version.](http://mathematica.stackexchange.com/q/42497/12)

---

<div class="post-metadata">

**Author:** ![paulbir](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@paulbir](https://community.wolfram.com/u/paulbir)\
**Post date:** [February 21, 2014, 8:42am UTC](https://community.wolfram.com/t/remote-kernel-shuts-down-after-several-seconds/1553/4 "2014-02-21T08:42:17Z")

</div>

Yes, it works fine.
