Declaration: This question is not as simple as a NullPointerException or how to deal with an NPE. It is about multi-threading programming. I do know how to catch an exception, the problem is I can not locate the source of this exception and even cannot figure out the problem is performance bottleneck or bug in logic. So I come here to ask for your help. And finally, I found the bug and solved it in my own answer.
I developed a REST API for uploading a chunk in the Spring boot application and passed the functionality testing. Below is the version info.
Spring Boot 1.5.8 with Embedded Tomcat
Now I wanna evaluate the performance under load testing with JMeter. And I designed the test plan and validated it in a gentle load successfully. Here is my test plan about Thread Properties,
Number of Threads (users): 3
Ramp-Up Period (in seconds): 1
Loop Count: 3
But when the load increased to 10 threads or even more, the test report showed some errors with 500 type. And the server printed some errors
2018-01-20 20:34:23.744 ERROR 57809 --- [o-8083-exec-346] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] i
n context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException: null
Does it mean that the server has reached the bottleneck or something else goes wrong in logical? And How can I debug and trace this problem?
Thanks.