lsongdev / lsongdev/input-event

Side-effect on request() when registering multiple input-events

Open
#16 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
65
Forks
22
PR merge metrics
No merged PRs in 30d

Description

I experience a side-effect on request() when registering multiple input-events. See the following code:

```
const InputEvent = require('input-event');
const request = require('request');

// Register the callback functions
const input0 = new InputEvent('/dev/input/event0');
const keyboard0 = new InputEvent.Keyboard(input0);

const input1 = new InputEvent('/dev/input/event1');
const keyboard1 = new InputEvent.Keyboard(input1);

console.log('start request()');
request.get('http://google.com', () => {
console.log('received result');
});
```

this leads to `start request()`, but then it hangs and `received result` is not reached.

if the `input1`/`keyboard1` lines are commented out, the `request()` call works as expected.

why does input-event have such side-effects? and how to avoid this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal reproduction from the issue with one and then two /dev/input/event devices, comparing the request.get callback behavior. Trace the input-event and request entry points involved in registering the two Keyboard instances, and consider the issue resolved when the cause of the hang and a verified fix or avoidance path are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, linux, node.js
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.