Re: [Sqlrelay-discussion] Blocking call when DB is offline
Brought to you by:
mused
From: Z S. <sha...@ho...> - 2012-05-10 12:16:51
|
Some further information by analysis on this issue: Using debug, I find out that the" sqlrcur_endQuery" calls sqlrcursor::sendQueryInternal() from it's inside: " bool sqlrcursor::sendQueryInternal(const char *query) { // if the first 8 characters of the query are "-- debug" followed // by a return, then set debugging on if (!charstring::compare(query,"-- debug\n",9)) { sqlrc->debugOn(); } if (!endofresultset) { abortResultSet(); } clearResultSet(); if (!sqlrc->openSession()) { return false; } cached=false; endofresultset=false; if (sqlrc->debug) { sqlrc->debugPreStart(); sqlrc->debugPrint("Sending Query:"); sqlrc->debugPrint("\n"); sqlrc->debugPrint(query); ... } " Strange thing is, when I use "Step over", openSession() as whole always returns true. However, when I use "Step into", the openSession() returns false on the following Line: bool sqlrconnection::openSession() { .... if (!authenticateWithListener()) { closeConnection(); return false; } } If openSession() fails, sqlrcur_endQuery will also return but with following debug messages for error: Connecting to listener... Inet socket: 10.10.10.120:9000 Authenticating with listener : bto_spp:bto_spp Waiting for auth success/failure... Setting Error Failed to authenticate. A network error may have ocurred. My question would be, why the return value of authenticateWithListener() could be different during run and debug (with "step-into" mode)? My expectation would be that authenticateWithListener() always return false (=>openSession() return false=>sqlrcur_sendQuery() can get returned) when DB get offline so that the system would not be blocked. Shan From: sha...@ho... To: sql...@li... Subject: Blocking call when DB is offline Date: Thu, 10 May 2012 10:29:48 +0000 Hi, My application needs to talk with Oracle DB. To improve performance, I use SQLRelay as intermediate layer. Recently, I have met with following problem : 1 Both SQLRelay and Oracle DB are started 2 Send query from my App (use 'sqlrcur_sendQuery') => OK 3 Shutdown Oracle DB 4 Send query again from my App, the call on "sqlrcur_sendQuery" is blocked (no return). 5 Turn on Oracle DB again 6 The old call to sqlrcur_sendQuery is returned. Further queries can all be processed. I activated log flag of SqlRelay (SQLRDEBUG=ON), and see following output: " Connecting to listener... Inet socket: 10.10.10.120:9000 Authenticating with listener : bto_spp:bto_spp Waiting for auth success/failure... No authentication error. Must Reconnect. Reconnecting to server: 10.10.10.120 inet port: 33681 Connected. Authenticating with connection : bto_spp:bto_spp Waiting for auth success/failure... No authentication error. Sending Query: SELECT * FROM HSPGW_CONFIG_VIEW WHERE ZONE_ID = 1682 AND IS_ENABLED = 1 AND TARIFF_ID = 16 Length: 90 Requesting a new cursor. Sending 0 Input Bind Variables: Sending Output Bind Variables: Send Column Info: yes Skipping and Fetching Skipping 0 rows Fetching 0 rows " Is there any way to let 'sqlrcur_sendQuery' return after certain time when the connection to DB is failed (like setting a timeout)? Otherwise the whole APP will hang as far as the DB is offline. Any help will be appreciated. Shan |