getcode function does not return output

eghbal.hosseini's Avatar

eghbal.hosseini

12 Jul, 2015 02:23 PM

Hi Chris,

I am trying to extract data using getcode, however it does not return any output. I was wondering if you have suggestion on how to fix this.
Thanks,
Eghbal

  1. Support Staff 1 Posted by Christopher Sta... on 13 Jul, 2015 02:14 PM

    Christopher Stawarz's Avatar

    Hi Eghbal,

    I'm not sure what you're referring to. Do you mean the MWorks MATLAB function getCodecs? If so, then I'll need some more details about how you're trying to use it.

    Cheers,
    Chris

  2. 2 Posted by eghbal.hosseini on 15 Jul, 2015 01:26 PM

    eghbal.hosseini's Avatar

    Yes, I meant 'getCodecs' , here is how I am calling the function:

    d=dir([cd,'/*','.mwk']);
    codec = getCodecs(d(1).name);

    it never returns an output, and I need to stop the function. I have attached the data file that causes the crash.

    Thanks,
    Eghbal

  3. Support Staff 3 Posted by Christopher Sta... on 15 Jul, 2015 06:44 PM

    Christopher Stawarz's Avatar

    Hi Eghbal,

    Thanks for the additional info.

    Your data file seems to be corrupted. The event stream ends abruptly after a "Called stop on state system" message, whereas a normal experiment shutdown should contain many additional events after that point. Did this experiment terminate abnormally (e.g. with a MWServer crash)?

    getCodecs is getting stuck because MWorks isn't handling the corrupted data well. I can improve this somewhat, so that you'll at least be able to retrieve events up to the point of corruption. I'll try to get that fix in to the nightly build soon.

    Cheers,
    Chris

  4. 4 Posted by eghbal.hosseini on 16 Jul, 2015 01:12 PM

    eghbal.hosseini's Avatar

    Hi Chris,

    Thanks for your email.
    The experiment did not terminate due to MWServer crash, after a number of trial experiment stopped manually.
    Do you recommend any sequence for stopping the task( closing the stream, stopping MWClient, Stopping MWServer, etc).

    Thanks,
    Eghbal

  5. Support Staff 5 Posted by Christopher Sta... on 16 Jul, 2015 07:38 PM

    Christopher Stawarz's Avatar

    Hi Eghbal,

    Do you recommend any sequence for stopping the task( closing the stream, stopping MWClient, Stopping MWServer, etc).

    I'd recommend the following sequence:

    1. Close data file (via MWClient)
    2. Close experiment (via MWClient)
    3. Close MWClient
    4. Close MWServer

    However, regardless of the shutdown sequence, the data file shouldn't get corrupted. Let me play around a little and see if there's some ordering of these steps that leaves the data file in an invalid state. If there is, then I need to figure out how to prevent that from happening.

    Thanks,
    Chris

  6. Support Staff 6 Posted by Christopher Sta... on 20 Jul, 2015 05:24 PM

    Christopher Stawarz's Avatar

    Hi Eghbal,

    The currently nightly build has some changes relevant to this issue:

    1. You should now be able to read the pre-corruption portion of your event file.
    2. It should be much harder to end up with an invalid event file due to abnormal/unexpected server shutdown.

    I believe the root of the issue is that, due to file I/O buffering, the end of the data file sometimes contained an incomplete event. If the file was closed normally, the missing data would be flushed to disk, and all would be well. However, if the server process shut down before that could happen, then the file would be unreadable.

    In the currently nightly, MWServer now tries to ensure that the on-disk event data is always readable, even if the file is still open. Hopefully, this will eliminate (or at least greatly reduce) future occurrences of this problem.

    Cheers,
    Chris

  7. 7 Posted by eghbal.hosseini on 20 Jul, 2015 10:13 PM

    eghbal.hosseini's Avatar

    Great, Thanks a lot.
    Eghbal

  8. Christopher Stawarz closed this discussion on 28 Jul, 2015 03:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac