In a timed task, the remote interface is called every hour for data synchronization. At first, the implementation method was to call the remote interface in a loop and pass in a single record each time, because each time we need to complete the operation of establishing a connection, data transfer, and disconnection, which is more expensive network and connection resources; later, after testing no problem, we changed to pass in a list for bulk operation after the loop is completed, and then the problem appeared.
10: 12:28.881 [http-nio-8200-exec-3] error c.y.c.s.h. globalexceptionhandler – [handleruntimeexception, 82] – Request Address’/doit ‘, unknown exception occurred org. springframework. http. converter. HttpMessageNotReadableException: JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens; nested exception is com. fasterxml. jackson. core. JsonParseException: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens
Version information of
feign is configured as follows:
# feign feign: sentinel: enabled: true okhttp: enabled: true httpclient: enabled: false client: config: default: connectTimeout: 10000 readTimeout: 10000 compression: request: enabled: true response: enabled: true
From the configuration, we can understand that the current configuration enables the request and response compression function. We know that when the compression is actually related to the size of the request body, if the requested data body itself is small, it can be transmitted directly without compression, which can save CPU resources for compression; there is a possible reason: compression is a threshold value, more than a certain threshold will be compressed. This can explain the previous question: why is it OK to transfer one piece of data at a time, but there is an error when transferring the list?
Just turn compression off.
Note: Due to the change to bulk transfer, the business processing takes longer and errors like “Timed out…” may appear at the request initiation side. The configuration here changes the timeout of HTTP connection from 10s to 60s; when the data synchronization is finished, change it back.
- feign.codec.EncodeException: Type definition error: [simple type, class java.util.Collections$3]
- SpringCloud Use openFeign Multipartfile to Upload Files Error: Current request is not a multipart request
- [Solved] spingboot Error: I/O error on POST request for “9411/api/v2/spans“: connect timed out
- [Solved] Java.lang.IllegalStateException: getReader() has already been called for this request
- [Solved] IO exception: NL exception was generated
- Microservice call exceptions: error feign.RetryableException: Read timed out executing POST http://xxx…….
- OpenFeignClient Use Object to Receive text/plain Type Return Error
- Doris streamload task reported an error connection reset [How to Solve]
- How to Solve Swagger error: typeerror: failed to fetch
- ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]
- Path does not chain with any of the trust anchors [Solved]
- [Solved] Upload Files Error: Request processing failed；nested exception is org.springframework.web.multipart.MultipartExcepti
- Rancher application service error: request entity too large
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testApplicat
- [Solved] Redis Error: org.springframework.data.redis.RedisConnectionFailureExceptionjava.net.SocketTimeoutException
- Tomcat cross server upload error 403forbidden [How to Solve]
- [Solved] SpringBoot Error: org.springframework.http.converter.HttpMessageNotReadableException
- Java will convert Excel to list set or JSON, export excel file to local, excel import and export, easyexcel tool class
- [Solved] ApiPost Error: org.springframework.web.multipart.MultipartException
- Ali easyexcel error: org.apache.poi.ss.usermodel.font.setbold (z) V