Skip to content

Star SDK LAN Printing Deadlock / Fail to openPort Issue with Multiple Android Devices and Multiple Printers #18

@amanyadavpims

Description

@amanyadavpims

Star SDK LAN Printing Deadlock / Fail to openPort Issue with Multiple Android Devices and Multiple Printers

Description

We are encountering an intermittent but critical issue with Star LAN printers where printing permanently fails with:

Fail to openPort.
TCP Port 9100 is busy.

The issue only occurs in a multi-device + multi-printer environment.

Once the issue occurs:

  • all subsequent print attempts fail

  • app restart does NOT resolve the issue

  • only disabling and re-enabling Android WiFi immediately restores printing

This suggests stale TCP socket/session handling inside the SDK, Android network stack interaction, or printer LAN session management.


Your device where the bug occurs

  • Device:
    Android POS tablets and Android phones

  • OS:
    Android 11 / Android 12 / Android 13

  • Browser:
    N/A

  • Version:
    StarIO Android SDK (latest available version used in production)


Your printer

  • Model Names:
    TSP143IIILAN

  • Firmware Version:
    Unknown

  • Interface:
    Ethernet / LAN (TCP port 9100)


Your development environment

  • Android Studio

  • Java

  • Production POS application

  • Multiple Android devices connected to same LAN

  • Multiple Star LAN printers connected to same LAN


To Reproduce

  1. Connect 2 Android devices to the same WiFi network

  2. Connect 2 Star TSP143IIILAN printers to the same network

  3. Send print jobs simultaneously or near-simultaneously

  4. Initial prints usually succeed

  5. After some time, printing permanently fails with:

    Fail to openPort.
    TCP Port 9100 is busy.
    
  6. Further retries continue failing indefinitely

  7. Restarting the application does NOT resolve the issue

  8. Turning Android WiFi OFF and ON immediately resolves the issue


Expected behavior

  • SDK should properly close and release TCP sessions after print completion

  • openPort() should recover automatically after failures/timeouts

  • SDK should not enter a permanent "Port 9100 is busy" state

  • Multiple Android devices and multiple printers should work reliably in production environments


Actual behavior

After several successful prints:

  • Communication.sendCommands() begins failing

  • openPort() fails permanently

  • SDK appears to retain or deadlock TCP socket state

  • Subsequent print attempts continue failing forever

  • Only toggling Android WiFi restores functionality

Observed logs:

Fail to openPort.
TCP Port 9100 is busy.

and:

Port acquire failed before release

Important observations

Scenario matrix

Scenario | Result -- | -- 1 Android → 1 Printer | Stable 1 Android → 2 Printers | Stable 2 Android → 1 Printer | Stable 2 Android → 2 Printers | Eventually fails

This suggests a concurrency/network socket handling issue.


Additional findings

  • The issue occurs even when only one print job is active (printCount = 1)

  • Issue survives app restart

  • Issue survives retry logic

  • WiFi reconnect fixes immediately

  • SDK callback completes but subsequent openPort() still fails


Relevant code

Communication.sendCommands(
    context,
    commands,
    settings.getPortName(),
    settings.getPortSettings(),
    6000,
    15000,
    context,
    callback
);

Callback:

@Override
public void onStatus(Communication.CommunicationResult communicationResult) {
    String m = Communication.getCommunicationResultMessage(communicationResult);
}

Logs

##- PrintingStar Main
##- Trying from Star Reprint: Count:1 KTS_181 :msg Fail to openPort.
releasePrinterPort STAR Trying release for: TCP:10.0.0.242
releasePrinterPort STAR Port acquire failed before release TCP Port 9100 is busy.

Additional context

This issue is affecting production restaurant POS environments.

The problem appears related to:

  • TCP socket cleanup

  • stale socket sessions

  • concurrent LAN printer access

  • or SDK internal port/session locking

We would appreciate guidance on:

  • recommended multi-printer/multi-device architecture

  • proper socket/session cleanup

  • whether sendCommands() is fully thread-safe

  • whether manual releasePort() is required after failures

  • recommended retry timing after openPort() failure

  • known issues involving LAN printers and multiple Android devices

Thank you.

Metadata

Metadata

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions