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 20001: StarIO10IllegalDeviceStateError #115

Open
joarwilk opened this issue May 6, 2024 · 8 comments
Open

Error 20001: StarIO10IllegalDeviceStateError #115

joarwilk opened this issue May 6, 2024 · 8 comments
Assignees
Labels
Platform: android Status: question Further information is requested Target: stario10 Issues related to the API and other StarIO10 library.

Comments

@joarwilk
Copy link

joarwilk commented May 6, 2024

Description

When discovering, it fails with error 2001: StarIO10IllegalDeviceStateError.

When shipping a batch of, say, 5 terminals, this can happen on 1-5 of those. It seems to be random.

How can we debug this invalid state?

Your device where the bug occurs

  • Device:
    Castle S1F2
  • OS:
    Verifone / Adyen, not sure about version

Your printer

  • Model Names:
    mC-Print3
  • Firmware Version:
    Unsure
  • Interface:
    LAN

To Reproduce

Start discovery. An error is caught with error code 2001 and description StarIO10IllegalDeviceStateError.
Sometimes its error 2000, with description "y"

Expected behavior

Printers are found

@can-miki
Copy link
Contributor

I would like to ask you a few questions to confirm the situation.

My understanding is that there are 5 terminals (Castle S1F2) connected to 1 printer (mC-Print3) via LAN. Is that so?
What API do you use for discovery?

Also, regarding StarIO10IllegalDeviceStateError I would like to check the following:

  • Is there a problem with your network equipment?
  • Is the printer turned on?

The flow when connecting the printer and device is "PortOpen → Status acquisition → PortClose".

  • Is the application configured to communicate between the device and the printer after "PortClose"?

@can-miki can-miki self-assigned this May 10, 2024
@can-miki can-miki added Status: question Further information is requested Platform: android Target: stario10 Issues related to the API and other StarIO10 library. labels May 10, 2024
@joarwilk
Copy link
Author

My understanding is that there are 5 terminals (Castle S1F2) connected to 1 printer (mC-Print3) via LAN. Is that so?
What API do you use for discovery?
Correct, but not connected at the same time. For any action they open, , and close.

We use this library to discover. Using starDeviceDiscoveryManagerFactory.create([InterfaceType.Lan]);

Is there a problem with your network equipment?
Is the printer turned on?

It works for some terminals and some not in the same network. This is consistent across different venues so it doesnt seem to be a local thing.

Is the application configured to communicate between the device and the printer after "PortClose"?

We dont even get to that state. It simply doesnt return any printers during discovery.

@can-miki can-miki added Status: work in progress Currently working on this issue and removed Status: question Further information is requested labels May 23, 2024
@nuzayets
Copy link

We're seeing this with 'Network Unavailable' even when the network is available (we observe traffic to our backend succeed, at the same time as this error). We see it across Android 12 and 13, on the latest version of star-io10. The devices are Lenovo YT-J706F and Lenovo TB125FU. The printer is TSP100iii on Bluetooth but this occurs during discovery. We also began seeing it in May '24, at the time on version 1.3.0.

The error is persistent. So far we have not found a solution.

@can-miki
Copy link
Contributor

can-miki commented Jul 22, 2024

@joarwilk @nuzayets
We apologize for the long wait.
Error 2001 is Network Unavailable.

This SDK ver.1.7.0 fixed an issue where StarIO10IllegalDeviceStateError(message: "Network Unavailable.") could occasionally be thrown even though the device is actually connected to the network.
Please update and see if the problem is resolved.

Thank you.

@can-miki can-miki added Status: question Further information is requested and removed Status: work in progress Currently working on this issue labels Jul 23, 2024
@nuzayets
Copy link

nuzayets commented Jul 24, 2024

The fix there said it's only for iOS. We're on Android 12 & 13, no effect there (we did try 1.7.0 before I commented). I did find a workaround: if we get Network Unavailable we scan without LAN and that works. Of course that will only work if people don't genuinely need LAN printers -- lucky for us that scenario hasn't happened since we don't officially support LAN printers (though some customers do use them).

My thinking was their network is blocking UDP multicast or something since that's usually how printer autodiscovery works (for normal desktop printers anyway), it does seem to be specific to a customer location and we can't repro it in-house. Since the workaround (not scanning LAN if we get Network Unavailable) works, we haven't put resources into reproducing it in the lab as of yet.

@bandit-ibayashi bandit-ibayashi added Status: work in progress Currently working on this issue and removed Status: question Further information is requested labels Aug 30, 2024
@can-miki
Copy link
Contributor

can-miki commented Dec 5, 2024

We apologize for the long wait.
@nuzayets
Thank you for sharing the information.

@joarwilk
I prepared 1 printer and 4 Android devices and checked the discovery function and printing, but this error(StarIO10IllegalDeviceStateError) did not occur.
Please let me know if you have any comments or steps to reproduce.

Printer: MCP31LB (F/W ver.3.81)
Interface: LAN

Device:
Pixel4a (Android version: 13)
Pixel6 (Android version: 14)
Pixel Tablet (Android version: 14)
Pixel8a (Android version: 15)

StarXpand SDK for ReactNative: 1.8.0

info Fetching system and libraries information...
(node:66813) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
System:
OS: macOS 14.6.1
CPU: (8) arm64 Apple M2
Memory: 121.78 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.11.0
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 10.9.0
path: /usr/local/bin/npm
Watchman:
version: 2024.07.01.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.1
- iOS 18.1
- macOS 15.1
- tvOS 18.1
- visionOS 2.1
- watchOS 11.1
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2412.12266719
Xcode:
version: 16.1/16B40
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.11
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.75.4
wanted: 0.75.4
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: false

@can-miki can-miki added Status: question Further information is requested and removed Status: work in progress Currently working on this issue labels Dec 5, 2024
@nuzayets
Copy link

nuzayets commented Jan 1, 2025

Yeah we couldn't reproduce it either. It happened at a customer site reliably even after switching hardware (both printer and Android device). We don't control their network so it's entirely possible something on their network was causing the LAN discovery to throw. There is likely a bug in handling unexpected behaviour in LAN discovery but I don't have any ideas.

@can-miki can-miki added Status: work in progress Currently working on this issue and removed Status: question Further information is requested labels Jan 7, 2025
@can-miki
Copy link
Contributor

can-miki commented Jan 9, 2025

Since this does not occur in the lab, there may be a problem with the end-user's network environment.

As shown previously, error 2001 is NetworkUnavailable.
NetworkUnavailable means "The network function of the host device cannot be used.", so it's likely that the host terminal is not connected to the network and an error has occurred.
In other words, from the printer's perspective, the host device is disconnected from the network. (For example, the device's Wi-Fi may be turned off.)

If you have any comments please let us know.

@can-miki can-miki added Status: question Further information is requested and removed Status: work in progress Currently working on this issue labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: android Status: question Further information is requested Target: stario10 Issues related to the API and other StarIO10 library.
Projects
None yet
Development

No branches or pull requests

4 participants