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

Error on Close serial port on Raspbarry Pi 4 64bits #242

Open
josepacelli opened this issue Sep 4, 2023 · 2 comments
Open

Error on Close serial port on Raspbarry Pi 4 64bits #242

josepacelli opened this issue Sep 4, 2023 · 2 comments

Comments

@josepacelli
Copy link

Erro on serial.close() on Raspbarry PI 4 64 bits

Using version 5.1.1

When a try to close the serial port the JVM crash

hs_err_pid827.log
hs_err_pid1059.log

image
The line on NRSerialPort that crash

@MrDOS
Copy link
Contributor

MrDOS commented Sep 4, 2023

Thanks for the report. Does this happen every time you call disconnect?

@josepacelli
Copy link
Author

josepacelli commented Sep 4, 2023

every time.

Tested with version 5.2.1 too.

claui pushed a commit to dbsystel/nrjavaserial that referenced this issue Jan 8, 2024
The `get_java_var_long` function returns 0 in several failure modes,
e.g. if a file descriptor is unavailable. [1]

However, one of the call sites is missing the result check, which causes
a JVM segfault if the return value is 0. The segfault occurs on
dereferencing the pointer: [2]

```c
eis->eventflags[SPE_DATA_AVAILABLE]
```

Add a result value check, throwing a proper IOException if it is 0.

See also similar issue NeuronRobotics#59. [3]

Fixes NeuronRobotics#112 [4], NeuronRobotics#136 [5] and NeuronRobotics#242 [6].

[1]: https://github.com/NeuronRobotics/nrjavaserial/blob/0df8b60485a56d7698b71183237b5615d02a8194/src/main/c/src/SerialImp.c#L5137-L5142
[2]: https://github.com/NeuronRobotics/nrjavaserial/blob/0df8b60485a56d7698b71183237b5615d02a8194/src/main/c/src/SerialImp.c#L3085
[3]: NeuronRobotics#59
[4]: NeuronRobotics#112
[5]: NeuronRobotics#136
[6]: NeuronRobotics#242

Reported-by: Alex Vasiliev <@alex-vas>
Reported-by: Łukasz Dywicki <luke@code-house.org>
Reported-by: Jose Pacelli <josepacelli@gmail.com>
Reported-by: Frank Hartwig <frank.fr.hartwig@deutschebahn.com>
claui pushed a commit to dbsystel/nrjavaserial that referenced this issue Jan 8, 2024
The `get_java_var_long` function returns 0 in several failure modes,
e.g. if a file descriptor is unavailable. [1]

However, one of the call sites is missing the result check, which causes
a JVM segfault if the return value is 0. The segfault occurs on
dereferencing the pointer: [2]

```c
eis->eventflags[SPE_DATA_AVAILABLE]
```

Add a result value check, throwing a proper IOException if it is 0.

See also similar issue NeuronRobotics#59. [3]

Fixes NeuronRobotics#112 [4], NeuronRobotics#136 [5] and NeuronRobotics#242 [6].

[1]: https://github.com/NeuronRobotics/nrjavaserial/blob/0df8b60485a56d7698b71183237b5615d02a8194/src/main/c/src/SerialImp.c#L5137-L5142
[2]: https://github.com/NeuronRobotics/nrjavaserial/blob/0df8b60485a56d7698b71183237b5615d02a8194/src/main/c/src/SerialImp.c#L3085
[3]: NeuronRobotics#59
[4]: NeuronRobotics#112
[5]: NeuronRobotics#136
[6]: NeuronRobotics#242

Reported-by: Alex Vasiliev <@alex-vas>
Reported-by: Łukasz Dywicki <luke@code-house.org>
Reported-by: Jose Pacelli <josepacelli@gmail.com>
Reported-by: Frank Hartwig <frank.fr.hartwig@deutschebahn.com>
claui pushed a commit to dbsystel/nrjavaserial that referenced this issue Feb 8, 2024
The `get_java_var_long` function returns 0 in several failure modes,
e.g. if a file descriptor is unavailable. [1]

However, one of the call sites is missing the result check, which causes
a JVM segfault if the return value is 0. The segfault occurs on
dereferencing the pointer: [2]

```c
eis->eventflags[SPE_DATA_AVAILABLE]
```

Add a result value check, throwing a proper IOException if it is 0.

See also similar issue NeuronRobotics#59. [3]

Fixes NeuronRobotics#112 [4], NeuronRobotics#136 [5] and NeuronRobotics#242 [6].

[1]: https://github.com/NeuronRobotics/nrjavaserial/blob/0df8b60485a56d7698b71183237b5615d02a8194/src/main/c/src/SerialImp.c#L5137-L5142
[2]: https://github.com/NeuronRobotics/nrjavaserial/blob/0df8b60485a56d7698b71183237b5615d02a8194/src/main/c/src/SerialImp.c#L3085
[3]: NeuronRobotics#59
[4]: NeuronRobotics#112
[5]: NeuronRobotics#136
[6]: NeuronRobotics#242

Reported-by: Alex Vasiliev <@alex-vas>
Reported-by: Łukasz Dywicki <luke@code-house.org>
Reported-by: Jose Pacelli <josepacelli@gmail.com>
Reported-by: Frank Hartwig <frank.fr.hartwig@deutschebahn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants