Recently refactoring the code of a project, after refactoring, debugging will always occur to access database exceptions. The hint is ' Invalid data packet '.
At first, I thought it was a problem with the statement of the database operation, it is normal to put the corresponding exception statement into the SQL window of Oracle.
On the internet to find a lot of posts, have not found the answer. Later, according to the debugging problems, when a database operation exception, immediately after another database operation will be abnormal. And then in the place of the error in a number of consecutive breakpoints, debugging found that an interface has not run out and ran to execute another interface of the other statements back to continue the execution of the current interface. Then I realized that it was a multi-threaded mess.
Refactoring before the execution of the database is single-threaded, there is no such exception, after the refactoring has this exception, I have suspected multithreading problem. Only, the start of the database operation is multi-threaded, using the SendMessage method, but the initiating operation is to send the message to the main thread, the main thread unified operation. From this, it will feel that the operation of this database is not multithreaded. Behold, this is the SendMessage buried pit, although this message is sent to the main thread, but the initiating threads are also waiting for the message to execute, where debugging appears to be multithreaded.
Solution: In the need to initiate database operations in the method to use the on-line lock, to ensure that the database operation to initiate mutual exclusion, problem solving.
Class Edatabaseerror with message ' Invalid data packet '