• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

Error -18 still pops up intermittently

Started by Fredrick Ughimi, October 22, 2011, 07:09:39 AM

Previous topic - Next topic

Fredrick Ughimi

Hello,

Error -18 is an issue that needs to be addressed.
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

cj

#46
These are the drops in my log the last few days

130122 031848 Dcon #227 Dropped
130122 151848 Dcon #229 Dropped

130123 031848 Dcon #349 Dropped
130123 151848 Dcon #406 Dropped

130124 031848 Dcon #457 Dropped
130124 151848 Dcon #464 Dropped

130125 031848 Dcon #478 Dropped
130125 151848 Dcon #480 Dropped

130126 031848 Dcon #483 Dropped
130126 031912 Conn #484 SK 424 

Bern Ertl

cj - I wanted to follow up on this dropped connections issue.  It's not clear from reading through the thread - with respect to the log you mentioned in your last post, what was the ConnectionTimeOut set to in your SqliteningServer.Cfg file?  Also, was the client app idle or interacting with the database on a regular basis?


cj

ConnectionTimeOut=-1
Connnections drop everyday at the same time.

G

#49
cj - I did catch this problem on clients with these steps:


  • In WndProc catch the %TCP_MSG and look for %FD_Close in LO(WORD, lParam). If received you can close/kill the connection, release the mutex, etc. and then try to reconnect.
  • If you use the console compiler you have to create a hidden (dumy-) window with a message pump first and then create an own small TcpWndProc for that reason.

Sorry, but I did extensive modifications to SQLitening for my own purposes so that it is not possible to show you compatible modifications for the original version. If you have questions, I will try to help if time permits.

cj

#50
Ping or other method works to detect error.
What causes the error is the question.
Here is some code pulled out of a program to test server.
Values are hard-coded to make this posting smaller.


#PBFORMS CREATED V2.01
#COMPILE EXE "\sql\bin\dummy"
#DIM ALL
%CreateError = 0  'cause slGet
#PBFORMS BEGIN INCLUDES
%USEMACROS = 1
#INCLUDE ONCE "win32api.inc"
#INCLUDE ONCE "\sql\inc\sqlitening.inc"
#PBFORMS END INCLUDES

#PBFORMS BEGIN CONSTANTS
%IDD_DIALOG1 = 101
%ID_TIMER = 500
#PBFORMS END CONSTANTS
'   ** Declarations **
'------------------------------------------------------------------------------
DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
#PBFORMS DECLARATIONS
'------------------------------------------------------------------------------
'   ** Main Application Entry Point **
'------------------------------------------------------------------------------
FUNCTION PBMAIN()
  ShowDIALOG1 %HWND_DESKTOP
END FUNCTION
'   ** CallBacks **
'------------------------------------------------------------------------------
CALLBACK FUNCTION ShowDIALOG1Proc()

  SELECT CASE AS LONG CB.MSG
    CASE %WM_INITDIALOG
      SetTimer(CB.HNDL, %ID_Timer, 60000, BYVAL %NULL)  'ping timer was 3000
      AutoStart CB.HNDL
    CASE %WM_NCACTIVATE
      STATIC hWndSaveFocus AS DWORD
      IF ISFALSE CB.WPARAM THEN
        ' Save control focus
        hWndSaveFocus = GetFocus()
      ELSEIF hWndSaveFocus THEN
        ' Restore control focus
        SetFocus(hWndSaveFocus)
        hWndSaveFocus = 0
      END IF
    CASE %WM_CLOSE
      ShutDownHere CB.HNDL
    CASE %WM_TIMER
      Ping CB.HNDL
    CASE %WM_COMMAND
      SELECT CASE AS LONG CB.CTL
      END SELECT
  END SELECT
END FUNCTION
'   ** Dialogs **
'------------------------------------------------------------------------------
FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
  LOCAL lRslt AS LONG

#PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
  LOCAL hDlg  AS DWORD

  DIALOG NEW hParent, "Ping Test", 245, 124, 201, 121, %WS_POPUP OR %WS_BORDER _
    OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR _
    %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
    %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
    %WS_EX_RIGHTSCROLLBAR, TO hDlg
#PBFORMS END DIALOG

  DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt

#PBFORMS BEGIN CLEANUP %IDD_DIALOG1
#PBFORMS END CLEANUP

  FUNCTION = lRslt
END FUNCTION
'------------------------------------------------------------------------------

FUNCTION Ping(hDlg AS DWORD) AS LONG
  LOCAL s, sPrevious AS STRING
  s = slGetStatus(4)
  DIALOG SET TEXT hDlg, s
  IF %CreateError THEN s = "Not 'Yes'"
  IF s <> "Yes" THEN
    AutoStart hDlg
  END IF
  BEEP
END FUNCTION

SUB AutoStart(hDlg AS DWORD)
  LOCAL result AS LONG
  result = ConnectToServer
  IF result THEN
    KillTimer hDlg, %ID_TIMER
    DIALOG END hDlg
    END
  END IF
  OpenDatabase hDlg
END SUB

SUB ShutDownHere(hDlg AS DWORD)
  KillTimer hDlg, %ID_TIMER
  slDisconnect
  'ScreenSettings 1  'write location and size
  ? "Shut down"
END SUB

FUNCTION ConnectToServer AS LONG
  LOCAL Attempt,result AS LONG
  FOR Attempt = 1 TO 4
    result = slConnect("192.168.1.2",0)
    IF result = 0 THEN
      EXIT FUNCTION
    ELSE
      SLEEP 1000
    END IF
  NEXT
ConnectToServerExit:
  FUNCTION = Result
END FUNCTION

FUNCTION OpenDataBase(hDlg AS DWORD) AS LONG
  LOCAL result AS LONG
  result = slOpen("test.db3","C")
  IF result = 0 THEN
    DIALOG SET TEXT hDlg, "Opened database
   ELSE
     DIALOG SET TEXT hDlg, slGetError
   END IF
END FUNCTION

G

QuoteConnnections drop everyday at the same time.
QuoteWhat causes the error is the question.

If loss of connection has nothing to do with SQLitening, it could be very hard to find that problem.



Bern Ertl

I'm running cj's connect test on my end to see if I get the same results.  If the connections don't drop at the same time on my end, I'd say it's very likely that the issue is not in SQLitening.

Bern Ertl

This is all a bit beyond my arena of programming expertise, but maybe it will mean something to some of you:

http://stackoverflow.com/questions/11712425/do-tcp-sockets-automatically-close-after-some-time-if-no-data-is-sent

I was looking for information on whether WinSock might have some built in connection/timeout settings/limitations.

cj

#54
The server is being pinged so the keep-alive is not an issue.
Notice that a disconnect occurs every 12-hours in my logs above.
I wish the IP address wasn't removed from that posting.

As I recall the IP address of a client changed after disconnecting and
reconnecting when using a wireless connection.  This is a continuation
of another posting (which I will try to find.)

Note:  In the source code above the 3000 millisecond ping is way to often.
Might change to 30000 or more.

Here is another posting on the same subject:

Start of thread:
http://www.sqlitening.com/support/index.php?topic=3412.0

http://www.sqlitening.com/support/index.php?topic=3412.msg18074;topicseen#msg18074

Bern Ertl

cj - I ran the connect test program (the one from your earlier post - the one that generated the log of disconnects 12 hours apart) for over 24 hours now with no disconnects.  I had the server and client app running on the same computer (in remote mode obviously).  It woudl appear that your disconnect issue is not related to SQLitening, but something in your network set up.

G

cj - my SQLitening application also runs 24/7 for several month now without any disconnect every 24h.
I would second the assumption that it could make some sense to analyse your network setup.

cj

Only connections 192.168,1.3 and higher disconnect.   The server is 192.168.1.2.

Is there a lease setting that could make a router drop a connection every 12 hours?
The clients always reconnect when slGetStatus(4) <> "Yes".
Bern, I see you didn't have another machine running the program.


cj

IPCONFIG /RENEW will drop the connections so
I will assume that the 24 hour DHCP lease is being
renewed every 12-hours causing the connections to drop.

Fredrick Ughimi

Hello,

Does the ConnectionTimeOut= parameter in the config file still equates to 30 minutes? Looks to me its 15 minutes or thereabout. And ConnectionTimeOut=-1 have no effect. Or is it just me?

Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet