Skip to content
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

jl_yield() causes segfault from c #15301

Closed
dioptre opened this issue Mar 1, 2016 · 12 comments
Closed

jl_yield() causes segfault from c #15301

dioptre opened this issue Mar 1, 2016 · 12 comments
Labels
needs more info Clarification or a reproducible example is required

Comments

@dioptre
Copy link

dioptre commented Mar 1, 2016

I'm inserting a jl_yield so that my hungry process permits @parallel and @spawnat - but alas it doesn't look possible. It sometimes allows me to @spawnat but mostly it just crashes.

I tried: uv_async_send using multiple threads and it was about 1000 times slower than what I'm doing at present in a single thread (must be due to lib_uv joins).

If I leave the yield out it works fine :(

Not sure about this one!

signal (11): Segmentation fault
unknown function (ip: 0x7faadaf6ea0c)
unknown function (ip: 0x7faadaf73b0c)
unknown function (ip: 0x7faadaf7e64c)
jl_apply_generic at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
wait at ./task.jl:369
yield at task.jl:355
jlcall_yield_21543 at  (unknown line)
jl_apply_generic at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
jl_call0 at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
processmusesync at libmse.so.0.0.1 (unknown line)
anonymous at /home/a/projects/bxi/server/pipeline.jl:50
jl_f_apply at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
anonymous at multi.jl:904
run_work_thunk at multi.jl:645
run_work_thunk at multi.jl:654
jlcall_run_work_thunk_21275 at  (unknown line)
jl_apply_generic at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
anonymous at task.jl:58
unknown function (ip: 0x7faadafe0f83)
unknown function (ip: (nil))
Worker 2 terminated.
ERROR (unhandled task failure): EOFError: read end of file

Place of the call looks like:

    while(1) {
        if ((size_t)d[4] % 100 == 0) {
            jl_yield();
            usleep(30000);
        }
@yuyichao
Copy link
Contributor

yuyichao commented Mar 1, 2016

Please quote your code, especially macros in order to not pull in random unrelated people. Please also give a more complete picture of what you are doing.

@dioptre
Copy link
Author

dioptre commented Mar 1, 2016

All I'm doing is writing to a buffer (float array) in RAM every 3 ms.

I pass a pointer from julia to the RAM location, and then write to it.

At this point I haven't even read the value back in Julia. Let me know if you'd like more details.

Ie.

   while(1) {
        if ((size_t)d[4] % 100 == 0) {
            jl_yield();
            usleep(30000);
        }
        d[1] = 0.5;
        d[2] = 0.5;
        usleep(3000);
}

@yuyichao
Copy link
Contributor

yuyichao commented Mar 1, 2016

It's still hard to tell what you are doing without seeing the complete picture.

@yuyichao
Copy link
Contributor

yuyichao commented Mar 1, 2016

i.e. the whole program or a stand alone repro.

@dioptre
Copy link
Author

dioptre commented Mar 2, 2016

I run:

@spawnat 2 begin
ccall( (:process, "libms.so.0.0.1"), Csize_t, (Ptr{Float32},), ee)
end

Which runs the following code for a while above successfully, then randomly crashes.

The thing it runs is the code below:

   while(1) {
        if ((size_t)d[4] % 100 == 0) {
            jl_yield();
            usleep(30000);
        }
        d[1] = 0.5;
        d[2] = 0.5;
        usleep(3000);
}

When I comment out the jl_yield it works fine.

I'm running it so I can share volatile memory between a julia process and a few others. But as I said it never gets read and crashes.

If I remove the jl_yield I can read and write to it without issues.

I hope that's enough to understand the plight!

@StefanKarpinski
Copy link
Member

Is jl_yield being called from a different thread?

@dioptre
Copy link
Author

dioptre commented Mar 2, 2016

no same one that i started with ccall from spawn 2
same effect happens too when called from pid 1

@dioptre
Copy link
Author

dioptre commented Mar 7, 2016

Bueller? Damn

@tkelman
Copy link
Contributor

tkelman commented Mar 7, 2016

Can you please provide a MCVE?

@vtjnash vtjnash added the needs more info Clarification or a reproducible example is required label Mar 8, 2016
@vtjnash
Copy link
Member

vtjnash commented Mar 8, 2016

if turning off COPY_STACKS in options.h fixes this, i suspect the solution is #13099

@dioptre
Copy link
Author

dioptre commented Mar 8, 2016

Thanks guys! I'll take a look!

On Tue, Mar 8, 2016, 11:28 Jameson Nash [email protected] wrote:

if turning off COPY_STACKS in options.h fixes this, i suspect the solution
is #13099 #13099


Reply to this email directly or view it on GitHub
#15301 (comment).

@KristofferC
Copy link
Member

Closing due to lack of more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Clarification or a reproducible example is required
Projects
None yet
Development

No branches or pull requests

6 participants