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

StringIndexOutOfBoundsException #2872

Closed
carstengrimm opened this issue Dec 11, 2021 · 10 comments
Closed

StringIndexOutOfBoundsException #2872

carstengrimm opened this issue Dec 11, 2021 · 10 comments
Labels

Comments

@carstengrimm
Copy link

carstengrimm commented Dec 11, 2021

When using "Right-Click" on a windows 10 Machine using the 1.21 i get the following error exception on my device, where touch events are not working afterwards anymore:

[server] INFO: Device: Xiaomi M2102J20SG (Android 11)
[server] WARN: Ignore touch event, it was generated for a different device size
[server] WARN: Ignore touch event, it was generated for a different device size
[server] WARN: Ignore touch event, it was generated for a different device size
[server] WARN: Ignore touch event, it was generated for a different device size
[server] ERROR: Exception on thread Thread[Thread-2,5,main]
java.lang.StringIndexOutOfBoundsException: length=262144; regionStart=7; regionLength=-1
        at java.lang.StringFactory.newStringFromBytes(StringFactory.java:79)
        at com.genymobile.scrcpy.ControlMessageReader.parseString(ControlMessageReader.java:124)
        at com.genymobile.scrcpy.ControlMessageReader.parseInjectText(ControlMessageReader.java:128)
        at com.genymobile.scrcpy.ControlMessageReader.next(ControlMessageReader.java:63)
        at com.genymobile.scrcpy.DesktopConnection.receiveControlMessage(DesktopConnection.java:107)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:82)
        at com.genymobile.scrcpy.Controller.control(Controller.java:73)
        at com.genymobile.scrcpy.Server$3.run(Server.java:125)
        at java.lang.Thread.run(Thread.java:923)

@rom1v rom1v added the bug label Dec 11, 2021
@rom1v
Copy link
Collaborator

rom1v commented Dec 11, 2021

Thank you very much for the report. I will investigate.

Could you reproduce easily, or it just happened once?

@carstengrimm
Copy link
Author

basically when the first screen is the homescreen already and you are using right-click as a habit, then (at least for me) it's crashing often, but seems by a few tries and reloads not 100% of the times.

once you change screens e.g. app drawer, search-assistent-screen or any app, then it seems not to crash anyway forcefully.

@carstengrimm
Copy link
Author

Just notice it might happen at other times as well...

Inside another App where i was scanning documents i push right-click (mouse) to go back a few and the same error occured, so it's not just the home screen.

@rom1v
Copy link
Collaborator

rom1v commented Dec 11, 2021

I will investigate in more details, but these questions might help to find the cause:

  • does it also happen on v1.20?
  • does it also happen if you never use copy-paste during the session?
  • do the messages WARN: Ignore touch event, it was generated for a different device size appear just before it crashes, or since the beginning?
  • do you start scrcpy with some command line parameters?
  • do you use the Windows release or did you build it from some commit?

@rom1v
Copy link
Collaborator

rom1v commented Dec 11, 2021

Also, if you could run with scrcpy -Vverbose and post the whole output when it fails, that would be perfect 😉

@rom1v
Copy link
Collaborator

rom1v commented Dec 18, 2021

@carstengrimm I fail to reproduce. The logs with scrcpy -Vverbose would help 😉

@rom1v
Copy link
Collaborator

rom1v commented Dec 23, 2021

Oh, it might possibly be a problem fixed by #2859 on development branch.

@carstengrimm Could you please test with this binary (which includes the fix because it is based on the development branch)?

Also, if you could answer the questions from my previous comments, that would help. I'd really want this to be fixed before the next release.

Thank you.

@carstengrimm
Copy link
Author

I have tested it more and more and after also trying to reinstall (instead of replacing/overwriting) files, it seems to not make the error reproducible, I have tested it with the fresh windows package, as well as the binary you link in your comment, and on both i am not able to reproduce the errors.

my guess is that some files from an earlier installations which have not been overwritten have caused the issues.

@rom1v
Copy link
Collaborator

rom1v commented Dec 28, 2021

Thank you for your new tests.

my guess is that some files from an earlier installations which have not been overwritten have caused the issues.

Did you ever install a non-release binary (either scrcpy.exe or scrcpy-server, typically posted on some issue thread)?

If you only ever installed releases, scrcpy refuses to start if the server version is not the same as the client version, so it should not happen.

Please don't hesitate to reopen if you encounter the problem again.

@carstengrimm
Copy link
Author

Basically since many many versions I have been downloading the
scrcpy-win64-vX.XX.zip
Package and just extract & replace exisiting files, whereas this has never been an issue.

Whereas before I started with the scrcpy-noconsole.bat (which was a leftover from previous installations)
Since now the .VBS file is introduced, the noconsole-file was outdated. I have then tried with noconsole, as well as the regular scrcpy.exe to use as an end user, without additional parameter, and ran into the said errors. overall the last few days when doing a fresh installation i have not run into any issue anymore but i am happy to report back once i notice something.

non-release, no i have never used any and exclusively download from the releases panel on github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants