tr3v3r / react-native-esc-pos-printer

An unofficial React Native library for printing on an EPSON TM printer with the Epson ePOS SDK for iOS and Epson ePOS SDK for Android
MIT License
137 stars 64 forks source link

🐛 Crash: EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 #129

Open tolypash opened 5 months ago

tolypash commented 5 months ago

Hey, we have Firebase crashlytics and we are often getting this crash. I have experienced it as well, it crashes during init of printer before sending.

Looks like when I try to connect to 2 different printers at the same time and send some commands it crashes. Attaching below the stack trace, but looks like it's crashing right here:

epos2_common_printer.c - Line 2022
EdcPrnConnect + 2022

Any ideas how we can avoid this? Looks like some invalid array pointer access. I have a background service class running jobs one by one but a user action might cause them to print at the same time. Perhaps we could throw an error that it's busy or something? Or actually print same time?

Thanks in advance 🙏

pos_issue_8534af632f2833e7c7b34ecc40dc9a8d_crash_session_736f0c9137a54b0d9eb2611926ea2ff1_DNE_0_v2_stacktrace.txt

Sheaffy commented 5 months ago

"Perhaps we could throw an error that it's busy or something?" This looks to me like your best option. Concurrency is always a pain to implement (Especially with printers).