Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When importing mysql2 and setting the value of lines in a setInterval it gives an EPERM error #30

Open
LaurentDhont opened this issue May 28, 2024 · 3 comments
Labels
bug Something isn't working gpiod-1.x all related to underlying libgpiod-1.x series help wanted Extra attention is needed tests some kind of test (unit, functional, real hardware) is needed

Comments

@LaurentDhont
Copy link

LaurentDhont commented May 28, 2024

This is a very strange issue, see below a piece of code that works, but when you require('mysql2') it stops working and gives the following error:

Error: EPERM, Operation not permitted
    at Timeout.main [as _onTimeout] (test.js:9:7)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7) {
  errno: 1,
  code: 'EPERM',
  syscall: '::setValue'
}

Also worth to mention is that this error only occurs when requiring mysql2 and calling the setValue in a setTimeout or setInterval

Code:

const lib = require('node-libgpiod');
const mysql2 = require('mysql2'); // when commenting this line everything works fine
const chip = new lib.Chip(4);
const line = new lib.Line(chip, 26);
line.requestOutputMode(0);

function main() {
        line.setValue(1);
}

setTimeout(main, 1000 * 30);

Versions:
Node: v20.13.1
mysql2: 3.9.8
node-libgpiod: 0.4.3
ubuntu: Ubuntu 24.04 LTS
Raspberry Pi 5B rev 1.0

@sombriks sombriks added bug Something isn't working gpiod-1.x all related to underlying libgpiod-1.x series labels Jun 1, 2024
@sombriks
Copy link
Owner

sombriks commented Jun 1, 2024

Hello @LaurentDhont
Thanks for report this, i'll investigate as soon as i get the work on gpiosim done.

@LaurentDhont
Copy link
Author

@sombriks Is there anything I can do to fix this or to make it work?

@sombriks
Copy link
Owner

Hello @LaurentDhont ,

indeed an odd issue, you can help me out to debug it by cloning the examples repository and running this one: https://github.com/sombriks/node-libgpiod-examples/tree/main/database-read-pin-write

i am still configuring other real hardware environments, but i was unable to reproduce the issue on my virtual machine or in my raspberry pi zero w (32 bits running raspbian 12 / node 18)

i still have a rasberry pi model 3 B+ to test and my new board, a raxda rock 3C, but i don't have a raspberry pi 5 at hand.

let me know when you have a moment to spare and try the sample code i built to explore this issue.

@sombriks sombriks added help wanted Extra attention is needed tests some kind of test (unit, functional, real hardware) is needed labels Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gpiod-1.x all related to underlying libgpiod-1.x series help wanted Extra attention is needed tests some kind of test (unit, functional, real hardware) is needed
Projects
None yet
Development

No branches or pull requests

2 participants