Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb service SocketTimeOutException causes database inconsistency
    primarykey
    data
    text
    <p>I want to overcome the following scenario when calling a Rails Web service from Android device with the help of Apache HTTP Client library</p> <p>Scenario : </p> <p>Client (Android) : Initiates HTTP POST request (Using Apache HTTP Client, JSON as exchange format) to inserts few records into the server database (MySQL).</p> <p>Server (Web service in Rails) : Process the request and inserts records into the database successfully BUT at the same moment time out <code>(SocketTimeOutException)</code> occurs at the client side.</p> <p>Client (Android) : On time out, retries to execute the same HTTP POST request and once again the same records get's inserted into the database and Database INCONSISTENCY occurs.</p> <p>Can any one please help me to overcome this situation.</p> <p>Thanks in advance</p> <p><strong>EDIT:</strong></p> <p>My current scenario:</p> <p>1) User tries to register using the Android app by filling and submitting data. So basically POST service contains all the required user into which is sent to the server (Rails and MySql)</p> <p>2) POST request is processed by server and this process is basically responsible for inserting records into the database and providing response to client with the USER_ID for which data is inserted.</p> <p>3) BOOM!! The data is inserted in the MySql database but for some reason there is <code>SocketTimeOutException</code> on the Android side and because of which there is no USER_ID on Android side and user tries to register again........ Data base inconsistency and I am SAD :(</p> <p>NOTE : Occurrence of step 3) is very rare.. BUT it is frequent when server is too busy or is having some processing load on it..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload