java.io.UTFDataFormatException: encoded string too long: 65538 bytes

Atlassian JIRA | Bradley Baetz | 1 year ago
  1. 0

    When the errors from a pre-receive hook are > 65535 characters and contains non-ASCII characters, Stash logs a java.io.UTFDataFormatException rather than returning the error to the user. I think that the issue is that one of the error messages that is going to be presented contains non-ASCII, which may be affecting how stash calculates the length of the string: 2015-05-14 17:38:51,253 DEBUG [threadpool:thread-1] admin 1058x428x0 9jdq8q 127.0.0.1 "POST /scm/project_1/tcollector.git/git-receive-pack HTTP/1.1" com.isroot.stash.plugin.YaccHook error: refs/heads/master: 4ab418df78b7bbfe1d7c8223f59b82537352d6a1: expected committer name 'Administrator' but found 'Ulrik Holmén' This can be 'fixed' by running: git filter-branch -f --env-filter ' if [ "$GIT_AUTHOR_NAME" = "Ulrik Holmén" ] then export GIT_AUTHOR_NAME="Ulrik Holmen" fi if [ "$GIT_COMMITTER_NAME" = "Ulrik Holmén" ] then export GIT_COMMITTER_NAME="Ulrik Holmen" fi ' which supports this being a UTF8/ASCII issue To reproduce (note that this is just to reproduce, but its not related to the plugin, just the error that the plugin generates) * Install the 'yet-another-commit-checker' plugin * Enable the hook on a repo, with the 'Require Matching Committer Email' and 'Require Matching Committer Name' options enabled * Try to push a repository with lots of commits that won't match, including a non-ASCII committer, ie: ** git clone https://github.com/OpenTSDB/tcollector.git ** git remote set-url http://localhost:7990/stash/scm/test/tcollector.git ** git push Expected results: A lot of errors about the commits not matching Actual results: $ git push Counting objects: 1614, done. Delta compression using up to 4 threads. Compressing objects: 100% (766/766), done. Writing objects: 100% (1614/1614), 542.72 KiB | 0 bytes/s, done. Total 1614 (delta 824), reused 1614 (delta 824) remote: Communication breakdown with Stash. To http://admin@localhost:7990/stash/scm/test/tcollector.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'http://admin@localhost:7990/stash/scm/test/tcollector.git' and a stacktrace in the Stash logs: java.io.UTFDataFormatException: encoded string too long: 65538 bytes at java.io.DataOutputStream.writeUTF(DataOutputStream.java:364) ~[na:1.7.0_45] at java.io.DataOutputStream.writeUTF(DataOutputStream.java:323) ~[na:1.7.0_45] at com.atlassian.stash.internal.hook.SocketTransferOutput.writeInChunks(SocketTransferOutput.java:58) ~[SocketTransferOutput.class:na] at com.atlassian.stash.internal.hook.SocketTransferOutput.writeStdErr(SocketTransferOutput.java:46) ~[SocketTransferOutput.class:na] at com.atlassian.stash.internal.hook.DefaultHookService.writeResponse(DefaultHookService.java:320) ~[DefaultHookService.class:na] at com.atlassian.stash.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:249) ~[DefaultHookService.class:na] at com.atlassian.stash.internal.hook.DefaultHookService$2$1.run(DefaultHookService.java:205) [DefaultHookService$2$1.class:na] at com.atlassian.stash.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:73) [StateTransferringExecutor$StateTransferringRunnable.class:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_45] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45] ... 1 frame trimmed

    Atlassian JIRA | 1 year ago | Bradley Baetz
    java.io.UTFDataFormatException: encoded string too long: 65538 bytes
  2. 0

    When the errors from a pre-receive hook are > 65535 characters and contains non-ASCII characters, Stash logs a java.io.UTFDataFormatException rather than returning the error to the user. I think that the issue is that one of the error messages that is going to be presented contains non-ASCII, which may be affecting how stash calculates the length of the string: 2015-05-14 17:38:51,253 DEBUG [threadpool:thread-1] admin 1058x428x0 9jdq8q 127.0.0.1 "POST /scm/project_1/tcollector.git/git-receive-pack HTTP/1.1" com.isroot.stash.plugin.YaccHook error: refs/heads/master: 4ab418df78b7bbfe1d7c8223f59b82537352d6a1: expected committer name 'Administrator' but found 'Ulrik Holmén' This can be 'fixed' by running: git filter-branch -f --env-filter ' if [ "$GIT_AUTHOR_NAME" = "Ulrik Holmén" ] then export GIT_AUTHOR_NAME="Ulrik Holmen" fi if [ "$GIT_COMMITTER_NAME" = "Ulrik Holmén" ] then export GIT_COMMITTER_NAME="Ulrik Holmen" fi ' which supports this being a UTF8/ASCII issue To reproduce (note that this is just to reproduce, but its not related to the plugin, just the error that the plugin generates) * Install the 'yet-another-commit-checker' plugin * Enable the hook on a repo, with the 'Require Matching Committer Email' and 'Require Matching Committer Name' options enabled * Try to push a repository with lots of commits that won't match, including a non-ASCII committer, ie: ** git clone https://github.com/OpenTSDB/tcollector.git ** git remote set-url http://localhost:7990/stash/scm/test/tcollector.git ** git push Expected results: A lot of errors about the commits not matching Actual results: $ git push Counting objects: 1614, done. Delta compression using up to 4 threads. Compressing objects: 100% (766/766), done. Writing objects: 100% (1614/1614), 542.72 KiB | 0 bytes/s, done. Total 1614 (delta 824), reused 1614 (delta 824) remote: Communication breakdown with Stash. To http://admin@localhost:7990/stash/scm/test/tcollector.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'http://admin@localhost:7990/stash/scm/test/tcollector.git' and a stacktrace in the Stash logs: java.io.UTFDataFormatException: encoded string too long: 65538 bytes at java.io.DataOutputStream.writeUTF(DataOutputStream.java:364) ~[na:1.7.0_45] at java.io.DataOutputStream.writeUTF(DataOutputStream.java:323) ~[na:1.7.0_45] at com.atlassian.stash.internal.hook.SocketTransferOutput.writeInChunks(SocketTransferOutput.java:58) ~[SocketTransferOutput.class:na] at com.atlassian.stash.internal.hook.SocketTransferOutput.writeStdErr(SocketTransferOutput.java:46) ~[SocketTransferOutput.class:na] at com.atlassian.stash.internal.hook.DefaultHookService.writeResponse(DefaultHookService.java:320) ~[DefaultHookService.class:na] at com.atlassian.stash.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:249) ~[DefaultHookService.class:na] at com.atlassian.stash.internal.hook.DefaultHookService$2$1.run(DefaultHookService.java:205) [DefaultHookService$2$1.class:na] at com.atlassian.stash.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:73) [StateTransferringExecutor$StateTransferringRunnable.class:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_45] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_45] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45] ... 1 frame trimmed

    Atlassian JIRA | 1 year ago | Bradley Baetz
    java.io.UTFDataFormatException: encoded string too long: 65538 bytes
  3. 0

    Model creation fails

    GitHub | 4 years ago | xrysoflhs
    java.io.UTFDataFormatException: encoded string too long: 168579 bytes
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 198#126723033

    GitHub | 1 year ago | velvia
    java.io.UTFDataFormatException: encoded string too long: 6653559 bytes
  6. 0

    Job Info serialization: encoded string too long

    GitHub | 1 year ago | TimMaltGermany
    java.io.UTFDataFormatException: encoded string too long: 6653559 bytes

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.UTFDataFormatException

      encoded string too long: 65538 bytes

      at java.io.DataOutputStream.writeUTF()
    2. Java RT
      DataOutputStream.writeUTF
      1. java.io.DataOutputStream.writeUTF(DataOutputStream.java:364)[na:1.7.0_45]
      2. java.io.DataOutputStream.writeUTF(DataOutputStream.java:323)[na:1.7.0_45]
      2 frames
    3. com.atlassian.stash
      StateTransferringExecutor$StateTransferringRunnable.run
      1. com.atlassian.stash.internal.hook.SocketTransferOutput.writeInChunks(SocketTransferOutput.java:58)[SocketTransferOutput.class:na]
      2. com.atlassian.stash.internal.hook.SocketTransferOutput.writeStdErr(SocketTransferOutput.java:46)[SocketTransferOutput.class:na]
      3. com.atlassian.stash.internal.hook.DefaultHookService.writeResponse(DefaultHookService.java:320)[DefaultHookService.class:na]
      4. com.atlassian.stash.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:249)[DefaultHookService.class:na]
      5. com.atlassian.stash.internal.hook.DefaultHookService$2$1.run(DefaultHookService.java:205)[DefaultHookService$2$1.class:na]
      6. com.atlassian.stash.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:73)[StateTransferringExecutor$StateTransferringRunnable.class:na]
      6 frames
    4. Java RT
      Thread.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[na:1.7.0_45]
      2. java.util.concurrent.FutureTask.run(FutureTask.java:262)[na:1.7.0_45]
      3. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[na:1.7.0_45]
      4. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[na:1.7.0_45]
      5. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[na:1.7.0_45]
      6. java.lang.Thread.run(Thread.java:744)[na:1.7.0_45]
      6 frames