Search code examples
javamysqlspringubuntu-18.04tomcat9

What may be the reason of "Unexpected end-of-input in VALUE_STRING" error


I developed a software and it was running properly until my mysql server crashed. After crash, I formatted my server, then installed everything I needed same as good old days. After formatting all softwares seems running properly, but the software I developed started to give some errors. Some of my columns in database are JSON. Normally I get all information from that column, modify it then restore it. Unfortunately after formatting I get this error:

2020-02-25 14:04:25.947  WARN 12528 --- [io-8443-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected end-of-input in VALUE_STRING; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unexpected end-of-input in VALUE_STRING at [Source: (PushbackInputStream); line: 1, column: 15939] (through reference chain: com.bWS.entity.kk.MyEntity["hatalar"])]

I didn't change anything from software, so it is not possible that my JSON data is invalid. In addition this error appears randomly, I mean for example in first try this error appears but second try everything works great. Especially if data length become longer, this error appears more frequently.

I need help to understand what the reason is.

Thank you all.

The system:

  • Ubuntu 18.04
  • MySQL 8.0.19 (I tried with 5.7 too)
  • OpenJDK 11.0.6
  • Tomcat 9

The Softwares: Java/Spring web applications(Client+Web Service)

EDIT

Sample Data:

{
    "id": 824,
    "gId": 4904,
    "eK": "https://algoritimbilisim.com",
    "tarih": "2020-02-25",
    "hatalar": {
        "periyot": [
            {
                "aralik": "10:00-11:00",
                "adi": [
                    {
                        "deger": "YOK",
                        "kalite": "1",
                        "hataKodlari": []
                    },
                    {
                        "deger": "YOK",
                        "kalite": "1",
                        "hataKodlari": []
                    }
                ]
            }
        ]
    }
}

Solution

  • Since you mentioned using Tomcat 9, attempting to share my recent experience.

    Recently I ran into similar issue. When upgraded to Tomcat 9.0.31, one of my test case which does a POST of a large JSON (little less than 2 MB) started failing randomly with:

    JSON parse error: Unexpected end-of-input in VALUE_STRING; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unexpected end-of-input in VALUE_STRING at [Source: (PushbackInputStream); line: 1, column: 17] (through reference chain: com.abc.xyz ["str"]) - JSON parse error: Unexpected end-of-input in VALUE_STRING; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unexpected end-of-input in VALUE_STRING at [Source: (PushbackInputStream); line: 1, column: 17] (through reference chain: com.abc.xyz["str"]) at

    Turns out that there was a bug in Tomcat 9.0.31 which caused this.

    https://bz.apache.org/bugzilla/show_bug.cgi?id=64202

    Moving to Tomcat 9.0.33 solved my issue.

    Are you also using Tomcat 9.0.31?