question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FATAL ERROR: Polling is not active

See original GitHub issue

Hello,

How to support device hot unplug ? As soon as I use the startPoll() function, the application crashes with the error indicated in the title. The endpoint used in the code is an Interrupt IN endpoint of a Cdc Acm communication interface.

Code

const usb = require('usb')
const dev = usb.findByIds(0x05f9, 0x4204)

dev.open()

const _if = dev.interface(0)
if (_if.isKernelDriverActive()) _if.detachKernelDriver()
_if.claim()

const _ci = _if.endpoint(0x81)

_ci.startPoll()

_ci.on('data',  (...args) => console.log('data',  ...args))
_ci.on('end',   (...args) => console.log('end',   ...args))
_ci.on('error', (...args) => console.log('error', ...args))

Steps to Reproduce:

  1. Plug device
  2. Start program
  3. Unplug device

Output

error [Error: LIBUSB_TRANSFER_NO_DEVICE] { errno: 5 }
error [Error: LIBUSB_TRANSFER_NO_DEVICE] { errno: 5 }
FATAL ERROR:  Polling is not active.
 1: 0xb09c10 node::Abort() [node]
 2: 0xa1c193 node::FatalError(char const*, char const*) [node]
 3: 0xa1c19c  [node]
 4: 0xad1abb napi_fatal_error [node]
 5: 0x7f28c8213006  [/home/[...]/node_modules/usb/prebuilds/linux-x64/node.napi.glibc.node]
 6: 0x7f28c822193b handleCompletion(Transfer*) [/home/[...]/node_modules/usb/prebuilds/linux-x64/node.napi.glibc.node]
 7: 0x7f28c821333d Napi::ThreadSafeFunction::CallJS(napi_env__*, napi_value__*, void*, void*) [/home/[...]/node_modules/usb/prebuilds/linux-x64/node.napi.glibc.node]
 8: 0xacfc61  [node]
 9: 0x1564956  [node]
10: 0x1577084  [node]
11: 0x15652a8 uv_run [node]
12: 0xa43dd5 node::SpinEventLoop(node::Environment*) [node]
13: 0xb4bdb6 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [node]
14: 0xacd592 node::Start(int, char**) [node]
15: 0x7f28cad542d0  [/usr/lib/libc.so.6]
16: 0x7f28cad5438a __libc_start_main [/usr/lib/libc.so.6]
17: 0xa4067c  [node]
Abandon (core dumped)

Additional Information

  • Operating System: Archlinux
  • Runtime v16.15.1
  • Node USB Version 2.5.1

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
thegeckocommented, Dec 10, 2022

@thegecko Can you please publish a release containing this fix?

@PatrickHallek this is now in the v2.6.0 release.

Apologies this took a while, I had to upgrade the CI pipeline

0reactions
strazzerecommented, Dec 8, 2022

The error leads to a fatal error because there is no one expecting it or catching it, so it bubbles up to the main thread. It is being raised via transferDone as a callback.

You are correct that something was wrong, though it is now fixed and the error would not be thrown anymore as this case can no longer occur.

Maybe this is just an opinion though, no idea what you are expecting the library to do. If it has another bug like this, then yes, it would throw an error erroneously again like it did. 🤷

Read more comments on GitHub >

github_iconTop Results From Across the Web

Polling Start/Stop on Input Endpoint · Issue #249 · node-usb ...
Hello, I have some trouble understanding how Polling Start / Stop mechanism works. const handler = dat => { console.log(dat); epIn.
Read more >
Fatal Error Occurred During Collection - could not poll Vcenter
Scenario 2: In case where the Vcenter being polled is not very large and not getting out of Memory errors, but throwing error...
Read more >
InfoSphere DataStage jobs fail with error - IBM
Symptom. DataStage jobs intermittently fail with the following combination of warning and fatal error messages:
Read more >
bonding device does not support polling, netconsole not ...
Description of problem: bonding devices does not support polling, netconsole is not available Version-Release number of selected component (if applicable): ...
Read more >
TPT01179 Error: occurred while polling for any ready socket ...
TPT01179 Error: occurred while polling for any ready socket, System errno: %d (%s) Explanation: A TPT process, task, component or function ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found