Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Mantra on Ubuntu 12.10

edited January 2013 in Miscellaneous

Sorry, I realize that Mantra was tested with Ubuntu 10.10 and that I probably should have installed that version. I am currently running Ubuntu 12.10. Unfortunately, once I try to define an object, the webcam preview appears for less than a second and the program crashes and shuts down. Better to install Ubuntu 10.10? or does anyone know if there is a quick fix? Thanks!

ps. this is the error I see in the terminal: Fatal Python error: (pygame parachute) Segmentation Fault
Aborted (core dumped)

Comments

  • edited 11:55AM

    Hi Wieske,

    I have encountered this issue as well with recent versions of Ubuntu. As far as I can tell, it's a memory error somewhere in the video4linux libraries, or maybe in the webcam specific drivers. I did not experience this problem with all webcams, so you could try using a different camera (if possible). Downgrading to Ubuntu 10.10 is also an option. With Ubuntu 10.10, I have never encountered this issue, even though I tested quite a few different cameras at the time.

    Anyway, I'll definitely look into this when I have time. Because it's not good that users should downgrade to an ancient version of Ubuntu, of course.

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 11:55AM

    I just tried it myself on Ubuntu 12.04.1 and indeed: segmentation fault. It happens with both of the cameras that I tried.

    I'm still not sure what exactly triggers the error, but it has to do with monitoring of the webcam output (i.e. showing the webcam on the screen). For example, the script works fine, and tracking an object works fine as well, as long as you do not simultaneously monitor the tracking output. But defining an object is a serious problem, because it requires monitoring of the webcam for obvious reasons.

    What you could do is the following:

    • Run qtmantra through valgrind. Valgrind is a memory debugger. In this case (for me at least) it prevents the crash from occurring, presumably because it slows down the execution of the program and prevents some race conditions from occurring. You can install valgrind from the repositories and run Mantra like so:

    valgrind qtmantra

    This will be really slow, but should allow you to define the objects.

    • Next, you start Mantra normally to start tracking. Make sure you disable the Show webcam output option under Advanced options.

    Possible? Yes. Convenient? No...

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 11:55AM

    Thanks for the information and advice! I'll look into the options today and see what will work best.

    By the way, congratulations! Hope you had a good day last Thursday!

    Ciao ciao

  • edited 11:55AM

    turns out that the valgrind debugger does not slow it down enough for me here. it crashes the same... also get one other error that I am not sure I had before... see below.

    I am having troubles installing 10.10 and finding the right dependencies, but I'll keep trying...


    libv4l2: error dequeuing buf: Input/output error
    Error in VIDIOC_DQBUF
    ==10520== Use of uninitialised value of size 8
    ==10520== at 0x194CC6E4: camera_capture (in /usr/local/lib/python2.7/dist-packages/mantra/_camera.so)
    ==10520== by 0x194CDFE1: _wrap_camera_capture (in /usr/local/lib/python2.7/dist-packages/mantra/_camera.so)
    ==10520== by 0x497EA3: PyEval_EvalFrameEx (in /usr/bin/python2.7)
    ==10520== by 0x498601: PyEval_EvalFrameEx (in /usr/bin/python2.7)
    ==10520== by 0x49F1BF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
    ==10520== by 0x4A895F: ??? (in /usr/bin/python2.7)
    ==10520== by 0x4E9F35: PyObject_Call (in /usr/bin/python2.7)
    ==10520== by 0x4EC119: ??? (in /usr/bin/python2.7)
    ==10520== by 0x4E9F35: PyObject_Call (in /usr/bin/python2.7)
    ==10520== by 0x4EA395: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7)
    ==10520== by 0x4B0BC7: ??? (in /usr/bin/python2.7)
    ==10520== by 0x4E39E99: start_thread (pthread_create.c:308)
    ==10520==
    ==10520== Invalid read of size 8
    ==10520== at 0x194CC6E4: camera_capture (in /usr/local/lib/python2.7/dist-packages/mantra/_camera.so)
    ==10520== by 0x194CDFE1: _wrap_camera_capture (in /usr/local/lib/python2.7/dist-packages/mantra/_camera.so)
    ==10520== by 0x497EA3: PyEval_EvalFrameEx (in /usr/bin/python2.7)
    ==10520== by 0x498601: PyEval_EvalFrameEx (in /usr/bin/python2.7)
    ==10520== by 0x49F1BF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
    ==10520== by 0x4A895F: ??? (in /usr/bin/python2.7)
    ==10520== by 0x4E9F35: PyObject_Call (in /usr/bin/python2.7)
    ==10520== by 0x4EC119: ??? (in /usr/bin/python2.7)
    ==10520== by 0x4E9F35: PyObject_Call (in /usr/bin/python2.7)
    ==10520== by 0x4EA395: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7)
    ==10520== by 0x4B0BC7: ??? (in /usr/bin/python2.7)
    ==10520== by 0x4E39E99: start_thread (pthread_create.c:308)
    ==10520== Address 0x199acaf20 is not stack'd, malloc'd or (recently) free'd
    ==10520==
    Fatal Python error: (pygame parachute) Segmentation Fault
    ==10520==
    ==10520== HEAP SUMMARY:
    ==10520== in use at exit: 20,579,120 bytes in 37,542 blocks
    ==10520== total heap usage: 184,004 allocs, 146,462 frees, 129,858,285 bytes allocated
    ==10520==
    ==10520== LEAK SUMMARY:
    ==10520== definitely lost: 12,560 bytes in 48 blocks
    ==10520== indirectly lost: 39,776 bytes in 1,249 blocks
    ==10520== possibly lost: 2,245,948 bytes in 4,052 blocks
    ==10520== still reachable: 18,280,836 bytes in 32,193 blocks
    ==10520== suppressed: 0 bytes in 0 blocks
    ==10520== Rerun with --leak-check=full to see details of leaked memory
    ==10520==
    ==10520== For counts of detected and suppressed errors, rerun with: -v
    ==10520== Use --track-origins=yes to see where uninitialised values come from
    ==10520== ERROR SUMMARY: 7974 errors from 154 contexts (suppressed: 4 from 4)
    Killed
  • edited 11:55AM

    Hi Wieske,

    I traced the memory error down and found that (for me) it occurs only under the following conditions: The GUI (the window with the buttons, etc.) is started and the webcam is monitored. Therefore, I made a small script that first starts the object definition phase and then goes on to recording, without starting the GUI. The best way to try it is to download the code snapshot from GitHub:

    Next, extract and install, like you probably did before. And run

    ./mantrascript.py

    For me, this works fine, and is probably an acceptable and reasonably user-friendly way to run the experiment. You can change some configuration options, such as the resolution, in the script itself. The script could also serve as the basis for a fully customized script, of course.

    A real fix would be much better, but I'm not sure whether that's feasible, as this issue appears not to be in Mantra itself, but in the underlying libraries.

    Please let me know how this goes!

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 11:55AM

    Works! Great! Very cool. Thanks for your help Sebastiaan!

  • edited 11:55AM

    ps. that other error was because I thought i may have found a solution with another dependency I downloaded- I don't really know what I was doing- but that wasn't actually the case. Upon deleting that update, the error disappeared too...

  • edited 11:55AM

    Just one other thing... When trying to make this mantrascript.py work directly in OpenSesame, the mouse is not visible in the window where you can define the object and Open Sesame crashes after Enter. If I run the mantrascript via the terminal, I get the same message Frouke reported in her comment (Failed to connect to the Mantra server...etc. ). I am pretty sure I am recording for the recording.tsv file stores samples and I have matched the server in Mantra_connect 40007 in OpenSesame with the one terminal reports (40007).

    Any ideas?

  • edited 11:55AM

    Do I understand correctly that you have copy-pasted mantrascript.py into an OpenSesame inline_script item? If so, that's would indeed cause trouble. The way to go would be to:

    • First, start mantrascript.py in a terminal, and leave this running (this is the server).
    • Next, start OpenSesame and connect to the server using the mantra plug-ins (or in an inline_script).

    So in this construction mantrascript.py is the server, and OpenSesame is the client. They can run on the same computer, that's no problem, but they are separate programs.

    Does that answer your question?

    Cheers!

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 11:55AM

    Partly. Thanks! I understand now the idea of the server and the client (should not try to put the server in client... ).

    Though, when I run it via the terminal, the problem is that OpenSesame does not connect to the Mantra server. The terminal reports listening on 40007 and I have set the mantra_connect plug in to 40007, but I get the connection error...

  • edited 11:55AM

    Just to be sure, I tried it the following (which worked):

    First, start mantrascript.py in a terminal. Define an object. Next, press Escape to go the tracking phase, and leave the window open, like this:

    image

    Next, open a simple test experiment in OpenSesame, such as this one:

    Make sure that the port matches the port reported by Mantra (but it sounds like you did). Next, run the experiment, and you should be up and tracking!

    If you try the steps above, does it still not work? If not, do you see any errors in the terminal, or in the OpenSesame debug window?

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

Sign In or Register to comment.