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

ReadOnlyMemoryError #107

Closed
cluttrdev opened this issue May 4, 2017 · 16 comments
Closed

ReadOnlyMemoryError #107

cluttrdev opened this issue May 4, 2017 · 16 comments

Comments

@cluttrdev
Copy link

Hi, when I try to create a window using

window = GLFW.CreateWindow(800, 600, "test")

I get the following error:

ERROR: LoadError: ReadOnlyMemoryError() in CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/andreas/.julia/v0.5/GLFW/src/glfw3.jl:351

Can you help me fix it? Thanks, Andreas

@jayschwa
Copy link
Member

jayschwa commented May 5, 2017

Can you provide more context? Are you making any calls to GLFW before CreateWindow? What version of Julia are you using? What operating system are you using?

@cluttrdev
Copy link
Author

Sorry, sure some context might be helpful...
I'm using julia v0.5.1 on Arch Linux and I'm not making any other calls to GLFW, just

using GLFW; window = GLFW.CreateWindow(800, 600, "test")

The error first showed up after I did a system update. I ran the same command on another (similar) one and it worked. So, this issue may not stem from GLFW.jl but from my system and if this is not the right place to discuss it, please let me know. But I'd be thankful for any help if you got an idea where this error comes from...

@jayschwa
Copy link
Member

I'm closing this issue since it sounds like it wasn't caused by GLFW.jl. Feel free to reopen if you now believe that GLFW.jl is the cause. Or add a note for future generations if you found the solution.

@lucianolorenti
Copy link

lucianolorenti commented Nov 24, 2017

I am having same problem with Ubuntu 16.04 and Archlinux. Both machines have an AMD gpu but different models. The first example of GLFW works for me. I don't know what additional information should I provide

@jayschwa
Copy link
Member

So it works from C, but not Julia? Can you provide the Julia code that causes it, and the stack trace from the error?

@lucianolorenti
Copy link

julia> using GLFW
julia> window = GLFW.CreateWindow(640, 480, "GLFW.jl")
ERROR: ReadOnlyMemoryError()
Stacktrace:
 [1] CreateWindow(::Int64, ::Int64, ::String, ::GLFW.Monitor, ::GLFW.Window) at /home/luciano/.julia/v0.6/GLFW/src/glfw3.jl:351 (repeats 2 times)

If I run the last line again

julia> window = GLFW.CreateWindow(640, 480, "GLFW.jl")

signal (11): Violación de segmento
while loading no file, in expression starting on line 0
unknown function (ip: 0x7fb04ed5eec9)
unknown function (ip: 0x7fb04eb8ed9d)
unknown function (ip: 0x7fb04ec28c3b)
unknown function (ip: 0x7fb04ec28d00)
unknown function (ip: 0x7fb04eb5e797)
unknown function (ip: 0x7fb0529a1eda)
glfwCreateWindow at /usr/lib/libglfw.so (unknown line)
CreateWindow at /home/luciano/.julia/v0.6/GLFW/src/glfw3.jl:351
CreateWindow at /home/luciano/.julia/v0.6/GLFW/src/glfw3.jl:351
unknown function (ip: 0x7fb056ee2993)
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1933
do_call at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:75
eval at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:242
eval_body at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:543
jl_interpret_toplevel_thunk at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:692
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:592
jl_toplevel_eval_in at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:496
eval at ./boot.jl:235
unknown function (ip: 0x7fb0734c239f)
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1933
eval_user_input at ./REPL.jl:66
unknown function (ip: 0x7fb0735301cf)
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1933
macro expansion at /home/luciano/.julia/v0.6/Revise/src/Revise.jl:775 [inlined]
#17 at ./event.jl:73
unknown function (ip: 0x7fb056ed7dcf)
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1933
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1424 [inlined]
start_task at /home/centos/buildbot/slave/package_tarball64/build/src/task.c:267
unknown function (ip: 0xffffffffffffffff)
Allocations: 4549413 (Pool: 4547987; Big: 1426); GC: 8
Violación de segmento

dmesg say
[ 5316.962956] julia[15387]: segfault at 10 ip 00007f90c0ca2eca sp 00007fff611fd020 error 4 in r600_dri.so[7f90c0a15000+98d000]

@SimonDanisch
Copy link
Member

Can you try julia-debug and maybe gdb? also, did you compile GLFW into your system image by any chance?
Those stack traces remind me of debugging static compilation issues...

@lucianolorenti
Copy link

lucianolorenti commented Nov 25, 2017

I have the same error whether I compile the shared library or I use the library located in deps.

I compiled GLFW with debug symbols and in Julia fails in glfw-3.2.1/src/context.c:54
glClear(GL_COLOR_BUFFER_BIT);

If I remove that line from GLFW I can create a window in Julia

@lucianolorenti
Copy link

lucianolorenti commented Nov 26, 2017

This issue #96 pointed me in the right direction. Apparently there is a problem when I compile julia with USE_SYSTEM_LLVM=1. When Julia compiles their own LLVM I can create the window without problems.

@ihnorton
Copy link

ihnorton commented Dec 2, 2017

Also seeing this. Looks like the problem is with multiple libLLVM are loaded in the same address space due to MESA/llvmpipe as in #96, but it's happening on Julia 0.6.1 generic build (Ubuntu 17.04).

x-ref: JuliaLang/julia#19606

Before and after creating a Gtk GLArea with this test script:

osboxes@osboxes:~$ pmap 7036 | grep -i llvm
00007f865432d000  27796K r-x-- libLLVM-3.9.so
00007f8655e52000   2048K ----- libLLVM-3.9.so
00007f8656052000   1324K r---- libLLVM-3.9.so
00007f865619d000     88K rw--- libLLVM-3.9.so
osboxes@osboxes:~$ pmap 7036 | grep -i llvm
00007f8624c83000  45000K r-x-- libLLVM-4.0.so.1
00007f8627875000      4K ----- libLLVM-4.0.so.1
00007f8627876000   3152K r---- libLLVM-4.0.so.1
00007f8627b8a000     20K rw--- libLLVM-4.0.so.1
00007f865432d000  27796K r-x-- libLLVM-3.9.so
00007f8655e52000   2048K ----- libLLVM-3.9.so
00007f8656052000   1324K r---- libLLVM-3.9.so
00007f865619d000     88K rw--- libLLVM-3.9.so

@SimonDanisch
Copy link
Member

@ihnorton I can't really reproduce this. What did you exactly do? I guess 7036 is the ID of the julia process? How do you keep it alive after the segfault?
I tried the fix from #96 (setting override USE_LLVM_SHLIB = 0), but that also didn't help.

@jayschwa
Copy link
Member

jayschwa commented Dec 4, 2017

This happens when Julia is compiled with certain parameters? Are you all building Julia yourselves or using prebuilt binaries? It seems like enough people have the issue that we should maybe add a blurb to the README about it, but I'd also like to figure out if there's some upstream issue to be raised.

@SimonDanisch
Copy link
Member

I'm building Julia myself and usually don't have any special parameters, but tried it now with override USE_LLVM_SHLIB = 0

@ihnorton
Copy link

ihnorton commented Dec 4, 2017

Sorry, I was about 5-7 bug depth into my evening at this point and was commenting here as a potential FYI rather than necessarily for help, should have been clear about that 😄 (and there may be multiple issues conflated here)

@jayschwa:

This happens when Julia is compiled with certain parameters?

In my case, I believe it's because of using mesa/llvmpipe graphics (I'm running ubuntu on virtualbox) or potentially other libraries that use LLVM at the same time as Julia. See JuliaLang/julia#19606

One work-around (for me) is to use LIBGL_ALWAYS_INDIRECT=1 but in real use that will probably be slow.

@SimonDanisch:

What did you exactly do?

window = GLFW.CreateWindow(800, 600, "test")

I guess 7036 is the ID of the julia process?

Yes -- the example is just showing that another version of libLLVM is loaded in the process after creating a GL context (which initializes mesa).

How do you keep it alive after the segfault?

gdb

@SimonDanisch
Copy link
Member

How do you keep it alive after the segfault?

gdb

Ah okay, so I did everything like you, but my process doesn't load a different llvm, since I'm not actually using the llvmpipe graphics.

@laudv
Copy link

laudv commented Apr 22, 2018

I am also experiencing the same issue on Arch Linux with AMD graphics. The GLFW getting started code runs fine, but I get the ReadOnlyMemoryException from Julia when creating a window. Has any progress been made on this issue using the binaries from julialang.org?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants