# Error reading DI

**URL:** <https://mworks.discourse.group/t/error-reading-di/191>\
**Category:** Support\
**Created:** [March 18, 2020, 7:05pm UTC](https://mworks.discourse.group/t/error-reading-di/191 "2020-03-18T19:05:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 18, 2020, 7:05pm UTC](https://mworks.discourse.group/t/error-reading-di/191/1 "2020-03-18T19:05:27Z")

</div>

Hi Chris,

One of our experiments is inexplicably crashing when we use the nightly from a few weeks ago (I haven’t tried the one in which you fixed some of the compile issues). It crashes after the first trial each time and says “ERROR reading DI, stopping IO and returning FALSE” (see screenshot). This experiment works fine with a version of 0.9 from April. Any suggestions for what might be the cause?

Thanks,  
Lindsey.

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 18, 2020, 7:05pm UTC](https://mworks.discourse.group/t/error-reading-di/191/2 "2020-03-18T19:05:27Z")

</div>

Attachment: [Screen\_Shot\_2020-03-17\_at\_4.05.19\_PM.jpg](https://mworks.discourse.group/uploads/short-url/4ofohXQ8JYIuyGeF8Fsp0lDYfuA.jpeg) (285 KB)

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 18, 2020, 7:11pm UTC](https://mworks.discourse.group/t/error-reading-di/191/3 "2020-03-18T19:11:31Z")

</div>

Hi Lindsey,

I don’t have any immediate insight into why this might be happening. If you want to send me your current LabJack plugin code, I can take a look and try to spot any issues. (Unfortunately, I’m working from home for the foreseeable future and don’t have my LabJack U6 to test on.)

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 18, 2020, 7:18pm UTC](https://mworks.discourse.group/t/error-reading-di/191/4 "2020-03-18T19:18:24Z")

</div>

Thanks Chris,  
Here is our LabJack Plugin repository:

> **[GitHub - Glickfeld-And-Hull-Laboratories/LabJackU6\_Plug-in: Labjack U6 plug...](https://github.com/Glickfeld-And-Hull-Laboratories/LabJackU6_Plug-in)**
>
> Labjack U6 plug in for MWorks. Contribute to Glickfeld-And-Hull-Laboratories/LabJackU6\_Plug-in development by creating an account on GitHub.

Let me know if I need to add you to our group.  
Do you know what kind of conditions will drive this error?  
And let me know if it would help to ship you a new LabJack 🙂  
Lindsey.

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 18, 2020, 8:59pm UTC](https://mworks.discourse.group/t/error-reading-di/191/5 "2020-03-18T20:59:02Z")

</div>

It seems to be specific to the variable set used- we’ll hopefully hunt it  
down.  
Lindsey.

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 19, 2020, 3:36pm UTC](https://mworks.discourse.group/t/error-reading-di/191/6 "2020-03-19T15:36:35Z")

</div>

Hi Lindsey,

Thanks for sharing your code.

The function call that’s failing just tries to read the current state of all ports from the LabJack and doesn’t appear to depend on any other settings or plugin state. This makes me think it’s some kind of I/O failure. Right next to the code that issues the error message, there’s a comment that says “We are seeing USB errors causing this”, which seems like a plausible (if unspecific) explanation.

As for the “crash”, the issue is that the plugin’s attempt to clean up in the face of this error is leading to a deadlock, which causes MWServer to become unresponsive. I created a [pull request](https://github.com/Glickfeld-And-Hull-Laboratories/LabJackU6_Plug-in/pull/1) with a fix for this issue (along with some general updates and cleanup). If you have any issues building or using the plugin after merging the PR, please let me know.

Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 19, 2020, 4:44pm UTC](https://mworks.discourse.group/t/error-reading-di/191/7 "2020-03-19T16:44:15Z")

</div>

Thanks- I’ll try this out and let you know if I have issues.  
May be a few days.  
Lindsey.

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 26, 2020, 2:57pm UTC](https://mworks.discourse.group/t/error-reading-di/191/8 "2020-03-26T14:57:08Z")

</div>

Hi Chris,

Sorry- I’m a pretty novice GitHub user: I merged your pull request and now  
see your commits and the merge on Github. However, when I pull (or fetch)  
to my local repository using my git client (Sourcetree), it doesn’t update-  
is there something else I need to do?

Also- since I updated to 0.9, I’ve been having some issues with the  
collection of counter signals using the Labjack/Mworks (this is how we  
synchronize our Mworks data to our microscope). Around the transition  
between trials it often has extra counts at intervals that are too fast to  
be the microscope rate. I can send more details on the issue if it would  
help, but could this have been addressed by some of these changes that you  
just made to the Labjack plugin?

Thanks,  
Lindsey.

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 26, 2020, 6:55pm UTC](https://mworks.discourse.group/t/error-reading-di/191/9 "2020-03-26T18:55:02Z")

</div>

Hi Lindsey,

> However, when I pull (or fetch) to my local repository using my git client (Sourcetree), it doesn’t update- is there something else I need to do?

I don’t know anything about Sourcetree. (I always use Git’s command line tools.) As a workaround, you could just [download the latest source](https://github.com/Glickfeld-And-Hull-Laboratories/LabJackU6_Plug-in/archive/master.zip).

> Around the transition between trials it often has extra counts at intervals that are too fast to be the microscope rate. I can send more details on the issue if it would help, but could this have been addressed by some of these changes that you just made to the Labjack plugin?

I really don’t have any idea why that would be happening or whether my changes would make a difference. Maybe try with the updated plugin and see if things work better?

Also, if you haven’t already, I’d recommend installing the latest [LabJack Exodriver release](https://labjack.com/sites/default/files/software/Exodriver_NativeUSB_Setup.zip). It’s possible that there were changes in macOS that have been addressed with recent versions of the driver.

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 26, 2020, 6:58pm UTC](https://mworks.discourse.group/t/error-reading-di/191/10 "2020-03-26T18:58:20Z")

</div>

Thanks- will try those things.  
Lindsey.

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 8:29pm UTC](https://mworks.discourse.group/t/error-reading-di/191/11 "2022-07-19T20:29:25Z")

</div>


