Hi again,
so, the progress of the new android REPL is going well, it already runs Quicklisp and can start swank, and right there I'm stuck now: How does one connect from the local computer to the android device, which is running the SLIME-listener?
They are connected via USB, and the device is /not/ rooted.
Since this is certainly of public interest, I ask here, thanks for any help! Below the link to the current APK of the REPL (you'll need android version >= 4.1, API >= 16):
http://lights-of-holiness.eu/tmp/repl.apk
After launching the app, do (there is currently no feedback of the progress, sorry):
(quicklisp) ; should take less than a minute, with a fast internet connection (start-swank) ; same as above (needs to byte-compile all 'contribs')
If I run:
(mp:all-processes)
it lists the running "SLIME-listener" process, so it seems to work...
Thanks for any help!
Paul
Hello,
swank listens by default only for localhost connections (for a good reason!). To force it to listen for connections from specific host other than 127.0.0.1 you have to bind swank::*loopback-interface* to it. For instance to listen for connections from everywhere on port 4005 you could use functions from https://gitlab.common-lisp.net/ecl/ecl-android/blob/master/assets/lisp/etc/u...
(defun start-swank () (format t "Starting swank server~%") (mp:process-run-function "SLIME-listener" (lambda () (let ((swank::*loopback-interface* "0.0.0.0")) (swank:create-server :port 4005 :dont-close t ;; :style nil #|:spawn|# )))))
(defun stop-swank () (format t "Stopping swank server~%") (swank:stop-server 4005) (format t ";; Swank off-line~%"))
Note, that newest slime/swank should support :spawn communication style just fine with ECL (my PR was merged lately). In that case it should be enough to call create-server which won't block (note that in the example above we create separate thread for that).
Since ECL isn't run from CLI but as shared library, it is useful to define implementation for implementation program (don't remeber for sure, but I think lack of this caused some problems later)
(defimplementation lisp-implementation-program () "Return the argv[0] of the running Lisp process, or NIL." "org.lisp.ecl")
Hope this helps.
Best regards,
Daniel
On 19.08.2017 16:32, PR wrote:
Hi again,
so, the progress of the new android REPL is going well, it already runs Quicklisp and can start swank, and right there I'm stuck now: How does one connect from the local computer to the android device, which is running the SLIME-listener?
They are connected via USB, and the device is /not/ rooted.
Since this is certainly of public interest, I ask here, thanks for any help! Below the link to the current APK of the REPL (you'll need android version >= 4.1, API >= 16):
http://lights-of-holiness.eu/tmp/repl.apk
After launching the app, do (there is currently no feedback of the progress, sorry):
(quicklisp) ; should take less than a minute, with a fast internet connection (start-swank) ; same as above (needs to byte-compile all 'contribs')
If I run:
(mp:all-processes)
it lists the running "SLIME-listener" process, so it seems to work...
Thanks for any help!
Paul
thanks to both of you, but it still doesn't work.
From the PC, I did:
$ adb forward tcp:4005 tcp:4005
so, this part works.
Daniel, I already "stole" the functions from the "ecl-android" project (prior to post my question); without them I would have been lost...
So, I'll have to play around a little... Of course I will post the solution here, if I get it to work.
Paul
2017-08-19 17:27 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
Hello,
swank listens by default only for localhost connections (for a good reason!). To force it to listen for connections from specific host other than 127.0.0.1 you have to bind swank::*loopback-interface* to it. For instance to listen for connections from everywhere on port 4005 you could use functions from https://gitlab.common-lisp.net/ecl/ecl-android/blob/master/assets/lisp/etc/u...
(defun start-swank () (format t "Starting swank server~%") (mp:process-run-function "SLIME-listener" (lambda () (let ((swank::*loopback-interface* "0.0.0.0")) (swank:create-server :port 4005 :dont-close t ;; :style nil #|:spawn|# )))))
(defun stop-swank () (format t "Stopping swank server~%") (swank:stop-server 4005) (format t ";; Swank off-line~%"))
Note, that newest slime/swank should support :spawn communication style just fine with ECL (my PR was merged lately). In that case it should be enough to call create-server which won't block (note that in the example above we create separate thread for that).
Since ECL isn't run from CLI but as shared library, it is useful to define implementation for implementation program (don't remeber for sure, but I think lack of this caused some problems later)
(defimplementation lisp-implementation-program () "Return the argv[0] of the running Lisp process, or NIL." "org.lisp.ecl")
Hope this helps.
Best regards,
Daniel
On 19.08.2017 16:32, PR wrote:
Hi again,
so, the progress of the new android REPL is going well, it already runs Quicklisp and can start swank, and right there I'm stuck now: How does one connect from the local computer to the android device, which is running the SLIME-listener?
They are connected via USB, and the device is /not/ rooted.
Since this is certainly of public interest, I ask here, thanks for any help! Below the link to the current APK of the REPL (you'll need android version >= 4.1, API >= 16):
http://lights-of-holiness.eu/tmp/repl.apk
After launching the app, do (there is currently no feedback of the progress, sorry):
(quicklisp) ; should take less than a minute, with a fast internet connection (start-swank) ; same as above (needs to byte-compile all 'contribs')
If I run:
(mp:all-processes)
it lists the running "SLIME-listener" process, so it seems to work...
Thanks for any help!
Paul
AFAIR I was connecting over wifi to the REPL on my Android device.
If the port forwarding works fine - do you have some logs either from emacs or running ECL process which show what's going on?
Daniel
On 19.08.2017 22:24, PR wrote:
thanks to both of you, but it still doesn't work.
From the PC, I did:
$ adb forward tcp:4005 tcp:4005
so, this part works.
Daniel, I already "stole" the functions from the "ecl-android" project (prior to post my question); without them I would have been lost...
So, I'll have to play around a little... Of course I will post the solution here, if I get it to work.
Paul
2017-08-19 17:27 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
Hello,
swank listens by default only for localhost connections (for a good reason!). To force it to listen for connections from specific host other than 127.0.0.1 you have to bind swank::*loopback-interface* to it. For instance to listen for connections from everywhere on port 4005 you could use functions from https://gitlab.common-lisp.net/ecl/ecl-android/blob/master/assets/lisp/etc/u...
(defun start-swank () (format t "Starting swank server~%") (mp:process-run-function "SLIME-listener" (lambda () (let ((swank::*loopback-interface* "0.0.0.0")) (swank:create-server :port 4005 :dont-close t ;; :style nil #|:spawn|# )))))
(defun stop-swank () (format t "Stopping swank server~%") (swank:stop-server 4005) (format t ";; Swank off-line~%"))
Note, that newest slime/swank should support :spawn communication style just fine with ECL (my PR was merged lately). In that case it should be enough to call create-server which won't block (note that in the example above we create separate thread for that).
Since ECL isn't run from CLI but as shared library, it is useful to define implementation for implementation program (don't remeber for sure, but I think lack of this caused some problems later)
(defimplementation lisp-implementation-program () "Return the argv[0] of the running Lisp process, or NIL." "org.lisp.ecl")
Hope this helps.
Best regards,
Daniel
On 19.08.2017 16:32, PR wrote:
Hi again,
so, the progress of the new android REPL is going well, it already runs Quicklisp and can start swank, and right there I'm stuck now: How does one connect from the local computer to the android device, which is running the SLIME-listener?
They are connected via USB, and the device is /not/ rooted.
Since this is certainly of public interest, I ask here, thanks for any help! Below the link to the current APK of the REPL (you'll need android version >= 4.1, API >= 16):
http://lights-of-holiness.eu/tmp/repl.apk
After launching the app, do (there is currently no feedback of the progress, sorry):
(quicklisp) ; should take less than a minute, with a fast internet
connection (start-swank) ; same as above (needs to byte-compile all 'contribs')
If I run:
(mp:all-processes)
it lists the running "SLIME-listener" process, so it seems to work...
Thanks for any help!
Paul
2017-08-19 23:25 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
AFAIR I was connecting over wifi to the REPL on my Android device.
If the port forwarding works fine - do you have some logs either from emacs or running ECL process which show what's going on?
ok, just to report the current state:
- if I run '(start-swank)' from the desktop (same sources as on android), it works locally - PC and tablet are connected via USB - both PC and tablet are in the same wlan, and can ping each other - port forwarding is enabled: 'adb forward tcp:4005 tcp:4005' - if I try to connect from the PC to Swank running on the tablet, Emacs logs these messages:
<snip Emacs messages>
Connecting to Swank on port 4005.. Lisp connection closed unexpectedly: connection broken by remote peer
error in process filter: if: Lisp connection closed unexpectedly error in process filter: Lisp connection closed unexpectedly Error running timer `slime-process-available-input': (error "Selecting deleted buffer")
</snip Emacs messages>
So, still no luck...
Paul
Daniel
On 19.08.2017 22:24, PR wrote:
thanks to both of you, but it still doesn't work.
From the PC, I did:
$ adb forward tcp:4005 tcp:4005
so, this part works.
Daniel, I already "stole" the functions from the "ecl-android" project (prior to post my question); without them I would have been lost...
So, I'll have to play around a little... Of course I will post the solution here, if I get it to work.
Paul
2017-08-19 17:27 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
Hello,
swank listens by default only for localhost connections (for a good reason!). To force it to listen for connections from specific host other than 127.0.0.1 you have to bind swank::*loopback-interface* to it. For instance to listen for connections from everywhere on port 4005 you could use functions from https://gitlab.common-lisp.net/ecl/ecl-android/blob/master/assets/lisp/etc/u...
(defun start-swank () (format t "Starting swank server~%") (mp:process-run-function "SLIME-listener" (lambda () (let ((swank::*loopback-interface* "0.0.0.0")) (swank:create-server :port 4005 :dont-close t ;; :style nil #|:spawn|# )))))
(defun stop-swank () (format t "Stopping swank server~%") (swank:stop-server 4005) (format t ";; Swank off-line~%"))
Note, that newest slime/swank should support :spawn communication style just fine with ECL (my PR was merged lately). In that case it should be enough to call create-server which won't block (note that in the example above we create separate thread for that).
Since ECL isn't run from CLI but as shared library, it is useful to define implementation for implementation program (don't remeber for sure, but I think lack of this caused some problems later)
(defimplementation lisp-implementation-program () "Return the argv[0] of the running Lisp process, or NIL." "org.lisp.ecl")
Hope this helps.
Best regards,
Daniel
On 19.08.2017 16:32, PR wrote:
Hi again,
so, the progress of the new android REPL is going well, it already runs Quicklisp and can start swank, and right there I'm stuck now: How does one connect from the local computer to the android device, which is running the SLIME-listener?
They are connected via USB, and the device is /not/ rooted.
Since this is certainly of public interest, I ask here, thanks for any help! Below the link to the current APK of the REPL (you'll need android version >= 4.1, API >= 16):
http://lights-of-holiness.eu/tmp/repl.apk
After launching the app, do (there is currently no feedback of the progress, sorry):
(quicklisp) ; should take less than a minute, with a fast
internet connection (start-swank) ; same as above (needs to byte-compile all 'contribs')
If I run:
(mp:all-processes)
it lists the running "SLIME-listener" process, so it seems to work...
Thanks for any help!
Paul
Did you try again (without restarting ECL on Android) to slime-connect to Android host? I don't remember, but I think I had such problem, but connecting again worked (but it may be just my imagination).
Other ideas: are you sure your slime and swank versions match?
Did you try to update slime and swank to the newest (i.e taken from github) versions?
On 20.08.2017 21:39, PR wrote:
2017-08-19 23:25 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
AFAIR I was connecting over wifi to the REPL on my Android device.
If the port forwarding works fine - do you have some logs either from emacs or running ECL process which show what's going on?
ok, just to report the current state:
- if I run '(start-swank)' from the desktop (same sources as on
android), it works locally
- PC and tablet are connected via USB
- both PC and tablet are in the same wlan, and can ping each other
- port forwarding is enabled: 'adb forward tcp:4005 tcp:4005'
- if I try to connect from the PC to Swank running on the tablet,
Emacs logs these messages:
<snip Emacs messages>
Connecting to Swank on port 4005.. Lisp connection closed unexpectedly: connection broken by remote peer
error in process filter: if: Lisp connection closed unexpectedly error in process filter: Lisp connection closed unexpectedly Error running timer `slime-process-available-input': (error "Selecting deleted buffer")
</snip Emacs messages>
So, still no luck...
Paul
Daniel
On 19.08.2017 22:24, PR wrote:
thanks to both of you, but it still doesn't work.
From the PC, I did:
$ adb forward tcp:4005 tcp:4005
so, this part works.
Daniel, I already "stole" the functions from the "ecl-android" project (prior to post my question); without them I would have been lost...
So, I'll have to play around a little... Of course I will post the solution here, if I get it to work.
Paul
2017-08-19 17:27 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
Hello,
swank listens by default only for localhost connections (for a good reason!). To force it to listen for connections from specific host other than 127.0.0.1 you have to bind swank::*loopback-interface* to it. For instance to listen for connections from everywhere on port 4005 you could use functions from https://gitlab.common-lisp.net/ecl/ecl-android/blob/master/assets/lisp/etc/u...
(defun start-swank () (format t "Starting swank server~%") (mp:process-run-function "SLIME-listener" (lambda () (let ((swank::*loopback-interface* "0.0.0.0")) (swank:create-server :port 4005 :dont-close t ;; :style nil #|:spawn|# )))))
(defun stop-swank () (format t "Stopping swank server~%") (swank:stop-server 4005) (format t ";; Swank off-line~%"))
Note, that newest slime/swank should support :spawn communication style just fine with ECL (my PR was merged lately). In that case it should be enough to call create-server which won't block (note that in the example above we create separate thread for that).
Since ECL isn't run from CLI but as shared library, it is useful to define implementation for implementation program (don't remeber for sure, but I think lack of this caused some problems later)
(defimplementation lisp-implementation-program () "Return the argv[0] of the running Lisp process, or NIL." "org.lisp.ecl")
Hope this helps.
Best regards,
Daniel
On 19.08.2017 16:32, PR wrote:
Hi again,
so, the progress of the new android REPL is going well, it already runs Quicklisp and can start swank, and right there I'm stuck now: How does one connect from the local computer to the android device, which is running the SLIME-listener?
They are connected via USB, and the device is /not/ rooted.
Since this is certainly of public interest, I ask here, thanks for any help! Below the link to the current APK of the REPL (you'll need android version >= 4.1, API >= 16):
http://lights-of-holiness.eu/tmp/repl.apk
After launching the app, do (there is currently no feedback of the progress, sorry):
(quicklisp) ; should take less than a minute, with a fast
internet connection (start-swank) ; same as above (needs to byte-compile all 'contribs')
If I run:
(mp:all-processes)
it lists the running "SLIME-listener" process, so it seems to work...
Thanks for any help!
Paul
2017-08-20 21:47 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
Did you try again (without restarting ECL on Android) to slime-connect to Android host? I don't remember, but I think I had such problem, but connecting again worked (but it may be just my imagination).
Other ideas: are you sure your slime and swank versions match?
Did you try to update slime and swank to the newest (i.e taken from github) versions?
oh yes, I tried everything I could imagine...
Both slime and swank versions match (it showed a warning previously, so I updated them to the latest version, on both computers).
Me thinks it's something trivial, which simply needs some more fantasy and patience (as always...). In fact, I have no experience with remote Slime connections, so this is my first try.
(Never mind, I like "puzzles" like this one, they teach you so much about things you didn't even intend to learn!)
Paul
On 20.08.2017 21:39, PR wrote:
2017-08-19 23:25 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
AFAIR I was connecting over wifi to the REPL on my Android device.
If the port forwarding works fine - do you have some logs either from emacs or running ECL process which show what's going on?
ok, just to report the current state:
- if I run '(start-swank)' from the desktop (same sources as on
android), it works locally
- PC and tablet are connected via USB
- both PC and tablet are in the same wlan, and can ping each other
- port forwarding is enabled: 'adb forward tcp:4005 tcp:4005'
- if I try to connect from the PC to Swank running on the tablet,
Emacs logs these messages:
<snip Emacs messages>
Connecting to Swank on port 4005.. Lisp connection closed unexpectedly: connection broken by remote peer
error in process filter: if: Lisp connection closed unexpectedly error in process filter: Lisp connection closed unexpectedly Error running timer `slime-process-available-input': (error "Selecting deleted buffer")
</snip Emacs messages>
So, still no luck...
Paul
Daniel
On 19.08.2017 22:24, PR wrote:
thanks to both of you, but it still doesn't work.
From the PC, I did:
$ adb forward tcp:4005 tcp:4005
so, this part works.
Daniel, I already "stole" the functions from the "ecl-android" project (prior to post my question); without them I would have been lost...
So, I'll have to play around a little... Of course I will post the solution here, if I get it to work.
Paul
2017-08-19 17:27 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
Hello,
swank listens by default only for localhost connections (for a good reason!). To force it to listen for connections from specific host other than 127.0.0.1 you have to bind swank::*loopback-interface* to it. For instance to listen for connections from everywhere on port 4005 you could use functions from https://gitlab.common-lisp.net/ecl/ecl-android/blob/master/assets/lisp/etc/u...
(defun start-swank () (format t "Starting swank server~%") (mp:process-run-function "SLIME-listener" (lambda () (let ((swank::*loopback-interface* "0.0.0.0")) (swank:create-server :port 4005 :dont-close t ;; :style nil #|:spawn|# )))))
(defun stop-swank () (format t "Stopping swank server~%") (swank:stop-server 4005) (format t ";; Swank off-line~%"))
Note, that newest slime/swank should support :spawn communication style just fine with ECL (my PR was merged lately). In that case it should be enough to call create-server which won't block (note that in the example above we create separate thread for that).
Since ECL isn't run from CLI but as shared library, it is useful to define implementation for implementation program (don't remeber for sure, but I think lack of this caused some problems later)
(defimplementation lisp-implementation-program () "Return the argv[0] of the running Lisp process, or NIL." "org.lisp.ecl")
Hope this helps.
Best regards,
Daniel
On 19.08.2017 16:32, PR wrote:
Hi again,
so, the progress of the new android REPL is going well, it already runs Quicklisp and can start swank, and right there I'm stuck now: How does one connect from the local computer to the android device, which is running the SLIME-listener?
They are connected via USB, and the device is /not/ rooted.
Since this is certainly of public interest, I ask here, thanks for any help! Below the link to the current APK of the REPL (you'll need android version >= 4.1, API >= 16):
http://lights-of-holiness.eu/tmp/repl.apk
After launching the app, do (there is currently no feedback of the progress, sorry):
(quicklisp) ; should take less than a minute, with a fast
internet connection (start-swank) ; same as above (needs to byte-compile all 'contribs')
If I run:
(mp:all-processes)
it lists the running "SLIME-listener" process, so it seems to work...
Thanks for any help!
Paul
Next update: attached there are 2 logs from swank (I enabled swank:*log-events*).
- log 1 is from desktop REPL (which works) - log 2 is from tablet REPL, which disconnects after 1, sometimes 2 seconds
The error message shown in Emacs is:
Error running timer `slime process available input': (error "Selecting deleted buffer")
(Maybe I need to ask on Slime mailing list.)
2017-08-21 12:14 GMT+02:00, PR polos.ruetz@gmail.com:
...
Well, I'm not really happy to announce that it (kind of) works now, but only with an ugly hack:
As suggested by Luís Oliveira (Slime mailing list), I added a 'break' at the start of function 'swank::close-connection%' (in file 'swank.lisp').
Now I can connect as usual, and Slime will break into the debugger (caused by the 'break').
And now the funny/bizzare part: as soon as I click on any function of the Emacs 'Backtrace:' list, the usual Slime REPL is shown and fully works!
I only need to pay attention on restarts, to never select the last ABORT option, because this would close the connection to Swank...
...and finally the OK: problem solved (thanks to Luís Oliveira / Slime mailing list):
This would be a possible patch to 'swank.lisp':
(defun repl-input-stream-read (connection stdin) (loop (let* ((socket (connection.socket-io connection)) + (inputs (list socket #-android stdin)) - (inputs (list socket stdin)) (ready (wait-for-input inputs))) (cond ((eq ready :interrupt) (check-slime-interrupts))
(quickly tested by me on both Android and PC.)
Paul
Since Daniel suggested the new :spawn style as swank:*communiication-style*, which works on the PC, I tried it on android, but there it gives this error:
Condition of type: SIMPLE-ERROR Timed condition variables are not supported.
Paul
Hey,
that probably means you still have slime without my recent improvements. Removal of timedwait was done in 898aac6348a307130fb1c3906db86bd1cb565e92 slime. It's present in 2.20 version.
Regards,
Daniel
On 26.08.2017 10:02, PR wrote:
Since Daniel suggested the new :spawn style as swank:*communiication-style*, which works on the PC, I tried it on android, but there it gives this error:
Condition of type: SIMPLE-ERROR Timed condition variables are not supported.
Paul
2017-08-31 21:12 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
that probably means you still have slime without my recent improvements. Removal of timedwait was done in 898aac6348a307130fb1c3906db86bd1cb565e92 slime. It's present in 2.20 version.
Yeah, :spawn would be nice, but unfortunately it's not working, even with Slime v2.20 and latest ECL git snapshot...
Now it gives a different error: a segfault, which is (to my knowledge) hard to debug on android.
--- you probably want to skip this / rant warning ---
Sorry for a personal note/rant, but it may shed some light on others having similar trouble:
I've currently given up on Swank running on android: it's simply not worth the trouble (at least in my case)! It's too slow starting up; the whole app has to be restarted on every connection problem; it freezes randomly for no apparent reason (maybe related to the Qt5/QML integration, as I found out indirectly; and I won't even go into the details of an (im)possible "workaround"...).
(1) For developing the Lisp part, I simply can do everything on the desktop, as I'm used to.
(2) For the UI part, it's basically the same as above; and if I really, really want to edit (on the PC) and reload (on android) the QML files directly from the device, I can do so quite easily, and without Slime (see README-1 of REPL example).
Paul
Regards,
Daniel
On 26.08.2017 10:02, PR wrote:
Since Daniel suggested the new :spawn style as swank:*communiication-style*, which works on the PC, I tried it on android, but there it gives this error:
Condition of type: SIMPLE-ERROR Timed condition variables are not supported.
Paul
2017-09-03 1:22 GMT+02:00, PR polos.ruetz@gmail.com:
...
Hi again,
so let's disentangle some confusion (partially created by me, sorry for that):
I have good news (for android) and bad news (for current Slime v2.20):
* First the good one:
I found out that old Slime v2.19 is stable on android (even though it needs a tiny patch, as mentioned in an earlier mail). (So, what I'm currently doing in EQL5-Android is to include a patched Slime v2.19, just to be safe)
* Now the bad news, _not_ related to android (and I can't be the only one experimenting this...):
With current Slime v2.20, the Slime REPL will freeze occasionally, especially if the response from Swank takes some time to compute, e.g. with TAB completion. What causes the "freezing" is a segfault in ECL:
I ran ECL through gdb, and the segfault seems related to GC (see attachment for the full backtrace). I was provoking the freezing with TAB completion (and it took me a few minutes to have it occur).
If my subjective observations match reality, then this is caused when a GC is triggered during a Slime REPL command, waiting for a response from Swank (since these pauses are mostly very short, that coincidence doesn't happen very often).
This problem definitely doesn't happen in Slime version v2.19, and it's not related to the new :SPAWN mode, because it happens even with :style NIL (the fallback communication style).
Paul
Hello,
Thanks for the report. Regarding bad news, can your confirm that this still happening with ecl from development branch?
Best regards, Daniel
On 24.09.2017 16:04, PR wrote:
2017-09-03 1:22 GMT+02:00, PR polos.ruetz@gmail.com:
...
Hi again,
so let's disentangle some confusion (partially created by me, sorry for that):
I have good news (for android) and bad news (for current Slime v2.20):
- First the good one:
I found out that old Slime v2.19 is stable on android (even though it needs a tiny patch, as mentioned in an earlier mail). (So, what I'm currently doing in EQL5-Android is to include a patched Slime v2.19, just to be safe)
- Now the bad news, _not_ related to android (and I can't be the only
one experimenting this...):
With current Slime v2.20, the Slime REPL will freeze occasionally, especially if the response from Swank takes some time to compute, e.g. with TAB completion. What causes the "freezing" is a segfault in ECL:
I ran ECL through gdb, and the segfault seems related to GC (see attachment for the full backtrace). I was provoking the freezing with TAB completion (and it took me a few minutes to have it occur).
If my subjective observations match reality, then this is caused when a GC is triggered during a Slime REPL command, waiting for a response from Swank (since these pauses are mostly very short, that coincidence doesn't happen very often).
This problem definitely doesn't happen in Slime version v2.19, and it's not related to the new :SPAWN mode, because it happens even with :style NIL (the fallback communication style).
Paul
Hm, I was able to reproduce it after all. It seems, that condition wait on ECL is prone to race conditions.
I've written alternative implementation using mailboxes, could you check with slime taken from https://github.com/dkochmanski/slime ? It seems to work for me, but before I make another pull request I want to double check.
Regards,
Daniel
On 29.09.2017 12:07, Daniel Kochmański wrote:
Hello,
Thanks for the report. Regarding bad news, can your confirm that this still happening with ecl from development branch?
Best regards, Daniel
On 24.09.2017 16:04, PR wrote:
2017-09-03 1:22 GMT+02:00, PR polos.ruetz@gmail.com:
...
Hi again,
so let's disentangle some confusion (partially created by me, sorry for that):
I have good news (for android) and bad news (for current Slime v2.20):
- First the good one:
I found out that old Slime v2.19 is stable on android (even though it needs a tiny patch, as mentioned in an earlier mail). (So, what I'm currently doing in EQL5-Android is to include a patched Slime v2.19, just to be safe)
- Now the bad news, _not_ related to android (and I can't be the only
one experimenting this...):
With current Slime v2.20, the Slime REPL will freeze occasionally, especially if the response from Swank takes some time to compute, e.g. with TAB completion. What causes the "freezing" is a segfault in ECL:
I ran ECL through gdb, and the segfault seems related to GC (see attachment for the full backtrace). I was provoking the freezing with TAB completion (and it took me a few minutes to have it occur).
If my subjective observations match reality, then this is caused when a GC is triggered during a Slime REPL command, waiting for a response from Swank (since these pauses are mostly very short, that coincidence doesn't happen very often).
This problem definitely doesn't happen in Slime version v2.19, and it's not related to the new :SPAWN mode, because it happens even with :style NIL (the fallback communication style).
Paul
2017-09-29 23:10 GMT+02:00, Daniel Kochmański daniel@turtleware.eu:
Hm, I was able to reproduce it after all. It seems, that condition wait on ECL is prone to race conditions.
I've written alternative implementation using mailboxes, could you check with slime taken from https://github.com/dkochmanski/slime ? It seems to work for me, but before I make another pull request I want to double check.
Great! I tested (on the PC) with ECL 16.1.3 (official release) and your Slime version, using the default :style :spawn, and tested longer as the last time, and it seems stable now.
Thanks!
Paul
Regards,
Daniel
On 29.09.2017 12:07, Daniel Kochmański wrote:
Hello,
Thanks for the report. Regarding bad news, can your confirm that this still happening with ecl from development branch?
Best regards, Daniel
On 24.09.2017 16:04, PR wrote:
2017-09-03 1:22 GMT+02:00, PR polos.ruetz@gmail.com:
...
Hi again,
so let's disentangle some confusion (partially created by me, sorry for that):
I have good news (for android) and bad news (for current Slime v2.20):
- First the good one:
I found out that old Slime v2.19 is stable on android (even though it needs a tiny patch, as mentioned in an earlier mail). (So, what I'm currently doing in EQL5-Android is to include a patched Slime v2.19, just to be safe)
- Now the bad news, _not_ related to android (and I can't be the only
one experimenting this...):
With current Slime v2.20, the Slime REPL will freeze occasionally, especially if the response from Swank takes some time to compute, e.g. with TAB completion. What causes the "freezing" is a segfault in ECL:
I ran ECL through gdb, and the segfault seems related to GC (see attachment for the full backtrace). I was provoking the freezing with TAB completion (and it took me a few minutes to have it occur).
If my subjective observations match reality, then this is caused when a GC is triggered during a Slime REPL command, waiting for a response from Swank (since these pauses are mostly very short, that coincidence doesn't happen very often).
This problem definitely doesn't happen in Slime version v2.19, and it's not related to the new :SPAWN mode, because it happens even with :style NIL (the fallback communication style).
Paul
Hah, that would explain why it has worked for me. In jni driver on ecl-android I've dup'ed stdin. See file jni/org_lisp_ecl_EmbeddedCommonLisp.c:63
LOGI("Redirecting I/O\n");
snprintf(tmp, 2048, "%s/ecl_output", lisp_dir); mkfifo(tmp, 0664); /* mode is O_RDWR to prevent blocking. Linux-specific. */ fd = open(tmp, O_RDWR | O_NONBLOCK); dup2(fd, 1); dup2(fd, 2); close(fd);
snprintf(tmp, 2048, "%s/ecl_input", lisp_dir); mkfifo(tmp, 0664); fd = open(tmp, O_RDONLY | O_NONBLOCK); dup2(fd, 0); close(fd);
So stdin had a valid value.
Best regards,
Daniel
On 25.08.2017 22:01, PR wrote:
...and finally the OK: problem solved (thanks to Luís Oliveira / Slime mailing list):
This would be a possible patch to 'swank.lisp':
(defun repl-input-stream-read (connection stdin) (loop (let* ((socket (connection.socket-io connection))
(inputs (list socket #-android stdin))
(inputs (list socket stdin)) (ready (wait-for-input inputs))) (cond ((eq ready :interrupt) (check-slime-interrupts))
(quickly tested by me on both Android and PC.)
Paul