star-micronics / StarXpand-SDK-iOS

StarXpand SDK for iOS is a software development kit for supporting application development for Star Micronics devices.
https://star-m.jp/starxpandsdk-oml.html
Other
27 stars 5 forks source link

Duplicate printing due to errors throws in the SDK #25

Open asa47 opened 9 months ago

asa47 commented 9 months ago

Description

We have noticed that sometimes the SDK returns an error even when the printing is successful:

  1. The StarXpand SDK receive a print command.
  2. It will print most of the times, but sometimes it will print and throw an error at the same time.

We have noticed this happening with the following errors messages:

Your device where the bug occurs

Your printer

Your development environment

ProductName: macOS ProductVersion: 14.3 BuildVersion: 23D56

To Reproduce

It seems to be random so it can't be replicated all the times.

  1. The StarXpand SDK receive a command to print.
  2. It will print most of the times, but sometimes it will print and throw an error at the same time.

Expected behavior

If the printing is successful, we shouldn't receive an error from the SDK.

Screenshots

This is a picture from a customer, they have duplicate prints because the first print command triggered an error and printed the ticket at the same time.

We then rely on what the SDK tells us, so we assumed the first print was unsuccessful and sent a new print command afterwards.

20240210_122510_2

Additional context

These are the logs that we receive from this iPad (print FX6BWR). Please let me know if you need additional details from our side.

[{
    "id": "AgAAAY2S-gJXvdl-5QAAAAAAAAAYAAAAAEFZMlMtamdGQUFBMkJ2ZzdKV0ZFZUFBQgAAACQAAAAAMDE4ZDkzYmYtM2JhOC00ZDgxLThlMTctNTVjMmNhZTBjMTFm",
    "content": {
        "timestamp": "2024-02-10T12:23:34.647Z",
        "StarXpand": {
            "printingData": {
                "cashDrawerChannel": "0",
                "identifier": "192.168.1.23",
                "printerModel": "TSP100",
                "buzzerChannel": "0",
                "title": "Kitchen Printer - #FX6BWR",
                "interfaceType": "TCP",
                "copies": "1"
            },
            "printingStatus": false,
            "printingErrorMessage": "Print timed out."
        },
        "device": {
            "device_model": "iPad12,1",
            "os_version": "17.1.1",
            "device_name": "iPad"
        }
    }
}, {
    "id": "AgAAAY2S-i6Nvdl-5wAAAAAAAAAYAAAAAEFZMlMtamdGQUFBMkJ2ZzdKV0ZFZUFBRAAAACQAAAAAMDE4ZDkzYmYtM2JhOC00ZDgxLThlMTctNTVjMmNhZTBjMTFm",
    "content": {
        "timestamp": "2024-02-10T12:23:45.965Z",
        "StarXpand": {
            "printingData": {
                "cashDrawerChannel": "0",
                "identifier": "192.168.1.23",
                "printerModel": "TSP100",
                "buzzerChannel": "0",
                "title": "Kitchen Printer - #FX6BWR",
                "interfaceType": "TCP",
                "copies": "1"
            },
            "printingStatus": true
        },
        "device": {
            "device_model": "iPad12,1",
            "os_version": "17.1.1",
            "device_name": "iPad"
        }
    }
}]
bandit-ibayashi commented 9 months ago

@asa47 We appreciate the detailed explanation of your Issue.

From this information, it is most likely that printing did not finish within the time that was specified in printTimeout. (ref) This Issue may be improved by setting the printTimeout value to a slightly longer time. We hope you will try this.

If for some reason time elapses before printing starts and the data arrives at the printer just before the time specified in printTimeout, the data will be printed but a ”Print Timed Out" error will occur. The default value for printTimeout is 30000 milliseconds. This value can be changed, and if it is changed, that value takes precedence.

If this does not improve the situation, it would be helpful if you could provide the following information.

FYI: "Print timed out." error might be output by StarIO10, but "Network Error" is not included in the errors output by our StarIO10 and was probably issued by something else.

Thank you in advance.

minusoneman commented 9 months ago

This seems very similar to #9 which is still unresolved.

We can reproduce this issue when printing from a single device to a single printer, when printing multiple jobs in a row. It appears that the printer connects successfully, but the print() command returns an error even when the printer successfully prints the ticket. We generally get Network unavailable. in the error.localizedDescription field. We know for a fact that the network connection is available, so it suggests a problem with this library.

To answer the questions above, for us:

DoctorCobweb commented 7 months ago

This seems very similar to #9 which is still unresolved.

We can reproduce this issue when printing from a single device to a single printer, when printing multiple jobs in a row. It appears that the printer connects successfully, but the print() command returns an error even when the printer successfully prints the ticket. We generally get Network unavailable. in the error.localizedDescription field. We know for a fact that the network connection is available, so it suggests a problem with this library.

To answer the questions above, for us:

  • Number of seconds from the start of printing until this error is displayed The ticket usually prints out within 2 - 3 seconds, we get the error immediately after
  • We support multi host and printers, but we can reproduce this with just a single host and printer

we have experienced this issue also.

we don't use this library, instead we have a stripped back version which simply sends http reqs to the printer endpoints. there is error checking from the printer's response status and the POS retries upon an error.

originally we tried this library and eventually stopped using it for this double-print issue. the same error message Network unavailable was seen and no more information was found to explain the cause.

the fact that we are seeing this in the stipped back version suggests to me the cause of the problem is with the printer hardware network inteface, the firmware, or both

the best solution we have is to communicate on the second docket that it may be a potential duplicate and to check

Tatsuki-Yamamoto2731 commented 3 months ago

@minusoneman @DoctorCobweb We recently released version 2.7.0, which improved the internal processing related to the Network Unavailable determination flow. Therefore, we would like you to update your StarIO10 to version 2.7.0 and check if the issue is resolved.

We are afraid to keep you waiting.