Giter Club home page Giter Club logo

Comments (4)

rene-aguirre avatar rene-aguirre commented on September 25, 2024

@c1728p9 thanks for the patch!

The patch looks safe, but I'd like to know more details about the bug for my testing (I'll merge the patch but refresh PyPi once I do my own testing):

  • Confirmed windows version (e.g. Windows 8, Windows 7 64 bits, etc).
  • Python version (also if 32 or 64 bits)

from pywinusb.

c1728p9 avatar c1728p9 commented on September 25, 2024

Hi @rene-aguirre

I have seen this problem on Windows 7 64 bit on 2 different computers. One was running 32 bit python version 2.7.8 and the other was running 64 bit python version 2.7.10. @geky also saw this problem on a 64 bit windows 7 machine. I haven't tested this on a 32 bit machine, but I would imagine it would have the same problem.

This problem is also very timing specific, at least for the hid devices we are using - mbed boards. The boards receive a 64 byte command on the interrupt out endpoint and then send a response on the interrupt in endpoint. The response on interrupt in comes 1-2ms after the write to the out endpoint. If just a few ms of delay is added after WaitForSingleObject in InputReportReaderThread there is enough time for the read to complete and the problem goes away. Adding a debugging print statements here was enough of a delay to make the errors go away. The crash also goes away if the buffers used by winapi.ReadFile are added to a global list to prevent them from being freed after the call (although this causes the memory to never be freed).

Me and @geky saw this problem when running pyOCD tests which try to stress the system by repeatedly opening a hid device, performing a series of reads/writes and then closing the hid device.

If you want to reproduce this problem it would probably be easiest to do with a HID device that continuously sends data to the pc on the interrupt in endpoint. If a packet is sent while the read is in progress but the buffers have been released then the crash will occur.

Let me know if you have any more questions or need more details. Thanks for the quick response on this issue.

from pywinusb.

rene-aguirre avatar rene-aguirre commented on September 25, 2024

Re-open due pending side effects verification.

from pywinusb.

rene-aguirre avatar rene-aguirre commented on September 25, 2024

Re-merged after regression fixes.

from pywinusb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.