<div dir="ltr">I have moved from Sly/Slynk to Slime/Swank and I still have the same problem: the connection times out. <div><br></div><div>From now on, I will focus exclusively on Slime. </div><div><br></div><div>I have traced the issue to Emacs' make-network-process. I started a separate thread on that topic in this forum.</div><div><br></div><div>Thanks</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 18, 2020 at 8:28 PM Tobias Rittweiler <<a href="mailto:trittweiler@gmail.com">trittweiler@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Mirko,<div dir="auto"><br></div><div dir="auto">You are starting the "slynk" server and not "swank". Slynk relates to a different Emacs mode that derives from Slime but is not 100 protocol compatible as it seems.</div><div dir="auto"><br></div><div dir="auto">Hth,</div><div dir="auto"><br></div><div dir="auto">T</div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 19 Apr 2020, 01:51 Mirko Vukovic, <<a href="mailto:mirko.vukovic@gmail.com" target="_blank">mirko.vukovic@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 3, 2020 at 1:37 PM Martin Simmons <<a href="mailto:martin@lispworks.com" rel="noreferrer" target="_blank">martin@lispworks.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>>>>> On Thu, 2 Apr 2020 14:16:55 -0400, Mirko Vukovic said:<br>
> <br>
> On Thu, Apr 2, 2020 at 9:09 AM Martin Simmons <<a href="mailto:martin@lispworks.com" rel="noreferrer" target="_blank">martin@lispworks.com</a>> wrote:<br>
> <br>
> > >>>>> On Thu, 2 Apr 2020 08:33:42 -0400, Mirko Vukovic said:<br>
> > ><br>
> > > On Thu, Apr 2, 2020 at 7:55 AM Martin Simmons <<a href="mailto:martin@lispworks.com" rel="noreferrer" target="_blank">martin@lispworks.com</a>><br>
> > wrote:<br>
> > ><br>
> > > > >>>>> On Wed, 1 Apr 2020 08:59:30 -0400, Mirko Vukovic said:<br>
> > > > ><br>
> > > > > On Tue, Mar 31, 2020 at 11:51 AM Martin Simmons <<br>
> > <a href="mailto:martin@lispworks.com" rel="noreferrer" target="_blank">martin@lispworks.com</a>><br>
> > > > > wrote:<br>
> > > > ><br>
> > > > > > >>>>> On Mon, 30 Mar 2020 21:16:00 -0400, Mirko Vukovic said:<br>
> > > > > > ><br>
> > > > > > > Hello,<br>
> > > > > > ><br>
> > > > > > > My setup is Sly on Spacemacs with Windows 10 running remote lisp<br>
> > on<br>
> > > > Linux<br>
> > > > > > > over a corporate network. I have not found a Sly mailing list,<br>
> > and I<br>
> > > > > > hope I<br>
> > > > > > > can get an answer here.<br>
> > > > > > ><br>
> > > > > > > Emacs is running Sly on Spacemacs on Windows 10. Lisp is running<br>
> > on a<br>
> > > > > > Linux<br>
> > > > > > > server. But Sly does not connect to the listening Lisp. Corporate<br>
> > > > network<br>
> > > > > > > security policies have changed. I can ask for IT to accommodate<br>
> > me,<br>
> > > > but<br>
> > > > > > > first I need to know what to ask for.<br>
> > > > > > ><br>
> > > > > > > So far, I have opened a tunnel, and started a listening lisp<br>
> > (details<br>
> > > > > > > below).<br>
> > > > > > ><br>
> > > > > > > In Emacs I get:<br>
> > > > > > ><br>
> > > > > > > sly-connect RET RET RET<br>
> > > > > > > [sly] Connecting to Slynk on port 4005..<br>
> > > > > > > helm-M-x-execute-command: make client process failed: Connection<br>
> > > > timed<br>
> > > > > > out,<br>
> > > > > > > :name, sly-9, :buffer, nil, :host, hal9000, :service, 4005,<br>
> > :nowait,<br>
> > > > nil,<br>
> > > > > > > :tls-parameters, nil<br>
> > > > > > ><br>
> > > > > > > The session transcript:<br>
> > > > > > > > ssh -L4005:localhost:4005 mirko@hal9000<br>
> > > > > > ><br>
> > > > > > > [mirko@hal9000 .roswell]$ ros -L ccl-bin run --load<br>
> > > > > > start-slynk-server.lisp<br>
> > > > > > ><br>
> > > > > > >  Added SLYNK path to ASDF:*CENTRAL-REGISTRY*<br>
> > > > > > > SLYNK's ASDF loader finished.<br>
> > > > > > >  Loaded ASDF system<br>
> > > > > > > ;; Slynk started at port: 4005.<br>
> > > > > > ><br>
> > > > > > >  Created SLYNK server on port 4005<br>
> > > > > > >  Set *USE-DEDICATED-OUTPUT-STREAM* to NIL<br>
> > > > > > > Clozure Common Lisp Version 1.11.5/v1.11.5  (LinuxX8664)<br>
> > > > > > ><br>
> > > > > > > For more information about CCL, please see<br>
> > <a href="http://ccl.clozure.com" rel="noreferrer noreferrer" target="_blank">http://ccl.clozure.com</a>.<br>
> > > > > > ><br>
> > > > > > > CCL is free software.  It is distributed under the terms of the<br>
> > > > Apache<br>
> > > > > > > Licence, Version 2.0.<br>
> > > > > > > ?<br>
> > > > > > ><br>
> > > > > > > My question is as follows:<br>
> > > > > > ><br>
> > > > > > >    1. Do I need bi-directional traffic on 4005?<br>
> > > > > ><br>
> > > > > > Assuming you are using the ssh tunnel above, then you don't need<br>
> > port<br>
> > > > 4005<br>
> > > > > > traffic on the LAN (it is all hidden in the tunnel).<br>
> > > > > ><br>
> > > > > > The most likely problem is that some firewall on the Windows<br>
> > machine is<br>
> > > > > > blocking port 4005.  You may need to configure that firewall to<br>
> > allow<br>
> > > > ssh<br>
> > > > > > to<br>
> > > > > > listen on localhost:4005 and/or to accept connections to it from<br>
> > > > Spacemacs.<br>
> > > > > > In theory you might have similar localhost firewall issues on<br>
> > hal9000,<br>
> > > > but<br>
> > > > > > that is less likely.<br>
> > > > > ><br>
> > > > > ><br>
> > > > > > >    2. Do I need bi-directional traffic on 22? (after recent<br>
> > changes I<br>
> > > > > > >    cannot ssh or scp into my Windows machine)<br>
> > > > > ><br>
> > > > > > I'm assuming that you ran the ssh command on the Windows 10 machine<br>
> > > > and it<br>
> > > > > > gave you a working login to hal9000.  If so, then it looks like you<br>
> > > > already<br>
> > > > > > have what you need for port 22.<br>
> > > > > ><br>
> > > > ><br>
> > > > > Yes, I can log in to hal9000 with the -L switch:<br>
> > > > ><br>
> > > > > > ssh -L4005:localhost:4005 mirko@hal9000<br>
> > > > > Last login: Thu Mar 19 14:33:17 2020 from 172.27.236.189<br>
> > > > > [mirko@hal9000 ~]$<br>
> > > > ><br>
> > > > ><br>
> > > > > ><br>
> > > > > > Note that bi-directional traffic on a connected socket is different<br>
> > > > from<br>
> > > > > > whether you can make a connection in both directions.<br>
> > > > > ><br>
> > > > > ><br>
> > > > > > >    3. What tools can I use to try to narrow down the cause of the<br>
> > > > > > problem?<br>
> > > > > > >    For instance, can I send a command to the lisp image, and see<br>
> > its<br>
> > > > > > effects<br>
> > > > > > >    on the lisp side?<br>
> > > > > ><br>
> > > > > > Firstly, run "netstat -antp" on hal9000 to see if Lisp is<br>
> > listening on<br>
> > > > port<br>
> > > > > > 4005.<br>
> > > > > ><br>
> > > > ><br>
> > > > > It looks that ccl-bin is listening:<br>
> > > > > $ sudo netstat -antp | grep :4005<br>
> > > > > tcp        0      0 <a href="http://127.0.0.1:4005" rel="noreferrer noreferrer" target="_blank">127.0.0.1:4005</a>          0.0.0.0:*<br>
> > > >  LISTEN<br>
> > > > >      104461/lx86cl64<br>
> > > > ><br>
> > > > ><br>
> > > > > ><br>
> > > > > > Secondly, run "netstat -anop tcp" on the Windows 10 machine to see<br>
> > if<br>
> > > > ssh<br>
> > > > > > is<br>
> > > > > > listening on port 4005.<br>
> > > > > ><br>
> > > > > ><br>
> > > > > I have Msys2's netstat. On the laptop:<br>
> > > > > > which netstat<br>
> > > > > /c/WINDOWS/system32/netstat<br>
> > > > > /c/Users/mirko/Downloads<br>
> > > > > > netstat -anop tcp | grep :4005<br>
> > > > >   TCP    <a href="http://127.0.0.1:4005" rel="noreferrer noreferrer" target="_blank">127.0.0.1:4005</a>         <a href="http://0.0.0.0:0" rel="noreferrer noreferrer" target="_blank">0.0.0.0:0</a>              LISTENING<br>
> > > >  12052<br>
> > > ><br>
> > > > Yes, both netstat outputs look good at that point.<br>
> > > ><br>
> > > ><br>
> > > > > > Thirdly, run "ssh -p 4005 localhost" on the Windows 10 machine.<br>
> > This<br>
> > > > use a<br>
> > > > > > ssh is very bogus, but it should at least give an error message<br>
> > with<br>
> > > > some<br>
> > > > > > diagnostics.  (Normally I would use telnet for this, but it is not<br>
> > > > > > installed<br>
> > > > > > on Windows 10 by default.)<br>
> > > > > ><br>
> > > > ><br>
> > > > > Outputs of both ssh and telnet on the laptop:<br>
> > > > > > which telnet<br>
> > > > > /usr/bin/telnet<br>
> > > > > /c/Users/mirko/Downloads<br>
> > > > > > telnet localhost 4005<br>
> > > > > Trying ::1...<br>
> > > > > Connected to localhost.<br>
> > > > > Escape character is '^]'.<br>
> > > > > Connection closed by foreign host.<br>
> > > ><br>
> > > > OK, so it is connected to the Windows side at least.<br>
> > > ><br>
> > > > Check that the Slynk server was created with :dont-close t (or set<br>
> > > > slynk:*dont-close* to t before creating it).  If dont-close is nil, it<br>
> > will<br>
> > > > only accept one connection, which makes debugging difficult.<br>
> > > ><br>
> > > > Then restart the log in to hal9000 with -v option to ssh to make it<br>
> > print<br>
> > > > debug<br>
> > > > information:<br>
> > > ><br>
> > > > ssh -v -L4005:localhost:4005 mirko@hal9000<br>
> > > ><br>
> > > > and try the telnet again to see what is happening at the Linux end.<br>
> > > ><br>
> > > > __Martin<br>
> > > ><br>
> > > Here is the test log. Telnet and ssh debug are at the bottom.<br>
> > > 1 Start slynk with :dont-close t<br>
> > ><br>
> > > Modified startup script:<br>
> > ><br>
> > > (let ((port 4005))<br>
> > >     (slynk:create-server :port port :dont-close t)<br>
> > >     (format t "~% Created SLYNK server on port ~a" port))<br>
> > > (setf slynk:*use-dedicated-output-stream* nil)<br>
> > ><br>
> > > 2 Started tunnel with verbose option, -v switch<br>
> > ><br>
> > > $ ssh -v -L4005:hal9000:4005 mirko@hal9000<br>
> > ><br>
> > > 3 Telnet on laptop side to laptop port 4005<br>
> > ><br>
> > > @laptop> telnet localhost 4005<br>
> > > Trying ::1...<br>
> > > Connected to localhost.<br>
> > > Escape character is '^]'.<br>
> > > Connection closed by foreign host.<br>
> > ><br>
> > > 4 SSH debug output<br>
> > ><br>
> > > @hal9000> debug1: Connection to port 4005 forwarding to hal9000 port<br>
> > > 4005 requested.<br>
> > > debug1: channel 3: new [direct-tcpip]<br>
> > > channel 3: open failed: connect failed: Connection refused<br>
> > > debug1: channel 3: free: direct-tcpip: listening port 4005 for hal9000<br>
> > > port 4005, connect from ::1 port 64100 to ::1 port 4005, nchannels 4<br>
> ><br>
> > It looks like hal9000 is resolving to the IPv6 localhost address ::1 on<br>
> > hal9000, but the Lisp is probably only listening on IPv4.<br>
> ><br>
> > Try restarting the tunnel with -L4005:<a href="http://127.0.0.1:4005" rel="noreferrer noreferrer" target="_blank">127.0.0.1:4005</a> to force IPv4.<br>
> ><br>
> > __Martin<br>
> ><br>
> <br>
> I restarted tunnel with IPv4: Now when I type something in the telnet<br>
> session, I get Lisp to respond (with debugger in this case). Sly is still<br>
> not connecting - maybe I need to restart emacs.<br>
> <br>
> Log:<br>
> 1 Start slynk with :dont-close t as before<br>
> 2 Start tunnel with verbose option, -v switch and IPv4<br>
> <br>
> $ ssh -v -L4005:<a href="http://127.0.0.1:4005" rel="noreferrer noreferrer" target="_blank">127.0.0.1:4005</a> 977315@hal9000<br>
> <br>
> 3 Telnet on laptop side to laptop port 4005<br>
> <br>
> @laptop> telnet localhost 4005<br>
> Trying ::1...<br>
> Connected to localhost.<br>
> Escape character is '^]'.<br>
> <br>
> 3.1 SSH debug output to telnet start<br>
> <br>
> debug1: Connection to port 4005 forwarding to 127.0.0.1 port 4005 requested.<br>
> debug1: channel 3: new [direct-tcpip]<br>
> <br>
> 4 Send command via telnet session<br>
> <br>
> Using telnet session send command:<br>
> <br>
> *features*<br>
> Connection closed by foreign host.<br>
> <br>
> 4.1 Results in an error in lisp due to syntax error<br>
> <br>
> ;; slynk:close-connection: Not an integer string: "*featu"<br>
> ;; closing 0 channels<br>
> ;; closing 0 listeners<br>
> ;; Event history start:<br>
> decode-message<br>
> close-connection: Not an integer string: "\x00FF\x00F4\x00FF\x00FD\x00FF" ...<br>
> close-connection Not an integer string:<br>
> "\x00FF\x00F4\x00FF\x00FD\x00FF" ... done.<br>
<br>
This \x00FF\x00F4\x00FF\x00FD\x00FF string is unexpected to me.  Did that<br>
happen when you tried to connect from emacs?  Restarting emacs is probably a<br>
good idea to rule out any issue with its state.<br>
<br>
<br>
> decode-message<br>
> close-connection: Not an integer string: "*featu" ...<br>
> ;; Event history end.<br>
> ;; Backtrace:<br>
> 0: (NIL #<Unknown Arguments>)<br>
> 1: (NIL #<Unknown Arguments>)<br>
> 2: (SLYNK-BACKEND:CALL-WITH-DEBUGGING-ENVIRONMENT #<Compiled-function<br>
> (:INTERNAL SLYNK::SAFE-BACKTRACE) (Non-Global)  #x302000A0BFFF>)<br>
> 3: (SLYNK::SAFE-BACKTRACE)<br>
> 4: (SLYNK::SIGNAL-SLYNK-ERROR #<CCL::PARSE-INTEGER-NOT-INTEGER-STRING<br>
> #x302000C1F32D> NIL)<br>
> 5: (SIGNAL #<CCL::PARSE-INTEGER-NOT-INTEGER-STRING #x302000C1F32D>)<br>
> 6: (CCL::%ERROR #<CCL::PARSE-INTEGER-NOT-INTEGER-STRING<br>
> #x302000C1F32D> (:STRING "*featu") 5975725205395)<br>
> 7: (PARSE-INTEGER "*featu" :START 0 :END 6 :RADIX 16 :JUNK-ALLOWED NIL)<br>
> 8: (SLYNK-RPC:READ-PACKET #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/4)<br>
> #x302000BDFD9D>)<br>
> 9: (SLYNK-RPC:READ-MESSAGE #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/4)<br>
> #x302000BDFD9D> #<Package "SLYNK-IO-PACKAGE">)<br>
> 10: (SLYNK::DECODE-MESSAGE #<BASIC-TCP-STREAM ISO-8859-1 (SOCKET/4)<br>
> #x302000BDFD9D>)<br>
> 11: (SLYNK::READ-LOOP #<MULTITHREADED-CONNECTION #x302000BDEFCD>)<br>
> 12: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS reader-thread(9) [Active]<br>
> #x302000BFEFBD> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL<br>
> CCL::%PROCESS-RUN-FUNCTION) #x302000BFED2F>))<br>
> 13: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<PROCESS<br>
> reader-thread(9) [Active] #x302000BFEFBD> (#<COMPILED-LEXICAL-CLOSURE<br>
> (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x302000BFED2F>))<br>
> 14: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))<br>
> ;; Connection to Emacs lost. [<br>
> ;;  condition: Not an integer string: "*featu"<br>
> ;;  type: CCL::PARSE-INTEGER-NOT-INTEGER-STRING<br>
> ;;  style: :SPAWN]<br>
<br>
This is working as expected -- the slynk/swank server is not a REPL so you<br>
can't just send *features* to it.<br>
<br>
__Martin<br></blockquote><div><br></div><div>

Apologies for the long silence on this topic - I had other pressing matters to deal with. I still cannot connect to the swank server from Emacs. </div><div><br></div><div>To summarize: Based on my tests (which are detailed below), I can connect to the swank server as tested via telnet. But emacs is still failing to connect to swank. I did some debugging and identified that make-network-process is timing out. </div><div><br></div><div>I will start another thread on the topic of figuring out why make-network-process is timing out.</div><div><br></div><div>Martin, many thanks for helping me out so far.</div><div><br></div><div>Here is my test procedure:</div><div><br></div><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-content" style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium"><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-outline-container-org220429c"><h2 id="gmail-m_6816282960735996364m_-8783968496660120103gmail-org220429c"><span>1</span> Establish tunnel</h2><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-text-1"><pre style="border:1px solid rgb(204,204,204);padding:8pt;overflow:auto;margin:1.2em">> ssh -v -L4005:<a href="http://127.0.0.1:4005" rel="noreferrer" target="_blank">127.0.0.1:4005</a> mirko@hal9000
</pre></div></div><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-outline-container-org158c9a2"><h2 id="gmail-m_6816282960735996364m_-8783968496660120103gmail-org158c9a2"><span>2</span> Start Swank server</h2><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-text-2"><pre style="border:1px solid rgb(204,204,204);padding:8pt;overflow:auto;margin:1.2em">[mirko@laptop] > ssh mirko@hal9000
[mirko@hal9000 .roswell]$ ros -L ccl-bin run --load start-slynk-server.lisp

 Added SLYNK path to ASDF:*CENTRAL-REGISTRY*
SLYNK's ASDF loader finished.
 Loaded ASDF system
;; Slynk started at port: 4005.

 Created SLYNK server on port 4005
 Set *USE-DEDICATED-OUTPUT-STREAM* to NIL
Clozure Common Lisp Version 1.11.5/v1.11.5  (LinuxX8664)

For more information about CCL, please see <a href="http://ccl.clozure.com" rel="noreferrer" target="_blank">http://ccl.clozure.com</a>.

CCL is free software.  It is distributed under the terms of the Apache
Licence, Version 2.0.
?
</pre></div></div><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-outline-container-org74feaec"><h2 id="gmail-m_6816282960735996364m_-8783968496660120103gmail-org74feaec"><span>3</span> Test laptop is listening on port 4005 with Telnet</h2><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-text-3"><pre style="border:1px solid rgb(204,204,204);padding:8pt;overflow:auto;margin:1.2em">> telnet localhost 4005
Trying ::1...
Connected to localhost.
Escape character is '^]'.
</pre></div></div><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-outline-container-org35c8407"><h2 id="gmail-m_6816282960735996364m_-8783968496660120103gmail-org35c8407"><span>4</span> Test tunnel to lisp</h2><div id="gmail-m_6816282960735996364m_-8783968496660120103gmail-text-4"><p>Typing stuff into telnet session</p><pre style="border:1px solid rgb(204,204,204);padding:8pt;overflow:auto;margin:1.2em">"foo"
Connection closed by foreign host.
</pre><p>makes CCL react. In this case it drops into debugger because of invalid input (I do not know what is valid input):</p><pre style="border:1px solid rgb(204,204,204);padding:8pt;overflow:auto;margin:1.2em">?
"; slynk:close-connection: Not an integer string: "\"foo\"
;; closing 0 channels
;; closing 0 listeners
;; Event history start:
... </pre></div></div></div><div><span style="font-size:14.4px;color:rgb(0,0,0);font-family:"Times New Roman""><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Times New Roman""><b><font size="4">5 Try slime-connect</font></b></span></div><div><span style="font-size:14.4px;color:rgb(0,0,0);font-family:"Times New Roman"">slime-connect times out</span></div><div><span style="font-size:14.4px;color:rgb(0,0,0);font-family:"Times New Roman""><br></span></div><div><span style="font-size:14.4px;color:rgb(0,0,0);font-family:"Times New Roman"">Created: 2020-04-18 Sat 19:41</span> </div></div></div>
</blockquote></div></div></div>
</blockquote></div>