-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
segmentation fault: in callback function when using actionlib #251
Comments
To put it simply, you cannot use In order to understand this issue perfectly, you need to know closure, free variables, let frame, macro expansion. It's a good lesson to understand how software works. |
Thanks to your introduction, I read some documents of these. I think I understood your point. In the actionlib.l, |
It' a deep world of euslisp.
It means that euslisp cannot call lambda function which is created in another let form. On the other hand, euslip can (funcall #'+ 1 2)
; => 3
(funcall '+ 1 2)
; => 3 And, euslisp can call closure even if the environment pointed by closure is on stack. (let ((var 1))
(let ((f #'(lambda (x) var))) ; closure include free variable!
(print (funcall f 100)))) ; call inside of environment
; => 1
(funcall (let ((var 1)) ; call out side of environment
(let ((f #'(lambda (x) var))) ; closure!
f)) 1)
; => SEGV |
(funcall (let ((var 1))
(let ((lambda '(lambda (x) var))) ; closure!
lambda)) 1)
; => undefined variable var! Because the code is evaluated as (funcall (eval '(lambda (x) var)) 1) And when euslisp evaluate the lambda, there is no such variable like |
And let us assume the code like followings: (let ((a 1)) ;; let-a
(let ((b 2)) ;; let-b
(let ((c 3)) ;; let-c
))) Stack of environment in euslisp evaluator is:
Euslisp can call lambda which created in parent environment.
However if you have lambda craeted in |
This article may help you to understand stack VM. |
Thanks. I got to know some of the characteristics of euslisp and what I should keep in mind when using it. |
sorry for super late response, but did you said that ◉ Kei Okada On Fri, Feb 27, 2015 at 5:44 PM, Kentaro Wada notifications@github.com
|
No, |
may be you can write as :execute-cb #'send self :execute-cb, ◉ Kei Okada On Sat, Mar 14, 2015 at 1:15 PM, Kentaro Wada notifications@github.com
|
In this code, and |
|
I see, please describe that on ◉ Kei Okada On Fri, Jun 12, 2015 at 3:32 PM, Ryohei Ueda notifications@github.com
|
I have never encountered this problem when using subscriber but actionlib. |
|
In subscription callback function, |
I see, so where should I describe about that? @k-okada |
@wkentaro Is this issue solved? |
When using actionlib and roseus, I had segmentation fault in its callback function, and resolved it by passing arguments to callback function.
I mean, in the sample code:
https://github.com/jsk-ros-pkg/jsk_roseus/blob/master/roseus/test/fibonacci-server.l
from
to
This segmentation fault doesn't always happen, and the sample code has no problem. In my project, however, I had it.
Actually I don't know the fundamental cause but in my case it is resolved with upper change. As reference my change log is:
wkentaro/jsk_apc@ac8dddf#diff-2a23e2389483ccb4c96d7f07ba40062eR58
The text was updated successfully, but these errors were encountered: