Help debugging?

I have another one: the stimulus “syncFlash” is, on rare occasions, either double playing, or jittering, or getting a blank frame injected, or something. If you have a chance, can you take a look at the code to see if you see any red flags in terms of how I’ve written the code related to that stimulus?

Thanks,
Evan

Hi Evan,

I don’t see anything in your experiment that looks suspicious.

“syncFlash” is, on rare occasions, either double playing, or jittering, or getting a blank frame injected, or something

Do you mean that you’ve seen it do all of these things, or are you just saying that it looks wrong and you don’t know why?

Chris

It looks like the “syncInterval” stimuli were getting cut short for some
reason, leading to two “syncFlash” stimuli being played in rapid
succession. My guess is there was some race condition happening with the
“stimEnding” variable shared by the “syncFlash” and “syncInterval” stimuli.
The experiment is supposed to work like this:

  1. stimEnding is reset to 0, and syncFlash plays
  2. when the last syncFlash frame is queued, stimEnding gets set to 1
  3. when stimEnding == 1, reset stimEnding to 0, dequeue syncFlash and
    play syncInterval
  4. when the last syncInterval frame is queued, stimEnding gets set to 1,
    sending execution back to 1.

The only explanation I can think of is that somehow stimEnding isn’t
properly being set to 0. Is it possible that the syncFlash stimulus is
resetting the stimEnding variable to 1 before the stimulus update
completes? I tried breaking out stimEnding into “flashEnding” and
“intervalEnding” to eliminate the possibility of this happening, and I’m no
longer seeing the glitch.

Evan

My guess is there was some race condition happening with the
“stimEnding” variable shared by the “syncFlash” and “syncInterval” stimuli.

That makes sense, although I admit I can’t find the error in your experiment, either.

I tried breaking out stimEnding into “flashEnding” and
“intervalEnding” to eliminate the possibility of this happening, and I’m no
longer seeing the glitch.

That sounds like a good fix.

Chris

Hi Chris,

I just read through the recent issue that Xiang Li was having, and it seems like I was running into the same issue. I had two alternating stimuli that shared the same “stimEnding” variable. However, you said you couldn’t find the error. Is it not the same problem? I can re-send the code if that helps.

Thanks,
Evan

Hi Evan,

Yes, it’s probably the same issue. Let me see if I can rework things in the frame list stimulus so that the “ending” variable never gets set more than once.

Chris

Let me see if I can rework things in the frame list stimulus so that the “ending” variable never gets set more than once.

Another option would be to make it always produce the “bug” behavior, if
that’s easier. There’s no problem with having to use two different
stimEnding vars, but the fact that using one produces unstable behavior is
a big problem, from our perspective (per lab meeting discussion).

Evan

Let me see if I can rework things in the frame list stimulus so that the “ending” variable never gets set more than once.

This is done (for both “ending” and “ended”) and will be in the nightly build soon.

Chris

Great, thanks!