#14 ✓resolved
Christopher Stawarz

Trying to read last event from data file causes segmentation fault

Reported by Christopher Stawarz | July 6th, 2010 @ 02:15 PM | in 0.4.5 (closed)

The attached Python script causes a segmentation fault on most (but not all) of the data files I've tried it with. The output typically looks like this:

$ ./print_last_event.py qlq.mwk
time    = 24054249
code    = 1
value   = {'payload': {'paused': 0, 'loaded': 1, 'running': 0, 'experiment path': '/var/folders/v1/v1qsITo9GJezLwbJ2VOfM++++TI/-Tmp-/MWorks/Experiment Cache/_Users_cstawarz_Documents_Work_McGovern_mworks_mw_suite_mw_examples_Tests_Action_QueueLiveQueue', 'experiment name': 'MyExperiment'}, 'payload_type': 4013, 'event_type': 1002}

time    = 211897957
code    = 3
Segmentation fault

Using the MATLAB getEvents function produces a similar result, so the problem isn't specific to the Python interface.

The crash happens at PythonDataBindingsHelpers.cpp:208, when trying to dereference a bogus pointer (e.g. 0x3) to a ScarabDatum struct. The bad pointer comes from EventWrapper::getPayload. The time on the event is suspect (~10x the time stamp of the previous event), which makes me think the whole event is bogus.

Is dfindex mistakenly reading past the end of the event stream? Or is there unexpected, non-event data at the end of the data file?

Comments and changes to this ticket

  • Christopher Stawarz
  • Christopher Stawarz

    Christopher Stawarz July 8th, 2010 @ 03:11 PM

    • State changed from “new” to “resolved”
    • Assigned user set to “Christopher Stawarz”

    Fixed in mw_datatools commit c47948122735119859c4f5dd2ae565fa77478423.

    The problematic last event was a RESERVED_TERMINATION_CODE event generated by ScarabWriteConnection. The event has a code and time but no payload (i.e. it's a list of length 2, instead of the typical 3). The time looks funny because it's absolute, not relative to the base time like the other events.

    EventWrapper::getPayload and getScarabEventPayload now return NULL for payload-free events.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

MWorks accessory libraries, build system, etc.

People watching this ticket

Attachments

Pages