• Welcome, Guest. Please login.
 
September 16, 2021, 11:13:42 PM

News:

Welcome to the SQLitening support forums!


Error -18 still pops up intermittently

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

Previous topic - Next topic

cj

October 28, 2011, 04:15:18 AM #30 Last Edit: October 29, 2011, 11:20:13 AM by cj
Testing to see if slGetStatus(4) keeps connections alive overnight.
Have 2 connections running over the internet and 2 running between machines..

The only time that I've seen lock-ups is when waiting to connect and clickng
on a button or attempting to close the dialog.  If this is addressed it will
be very hard to lock up a client.



SUB Ping 'only called by TIMER1
  LOCAL s AS STRING
  INCR gCounter 'not needed, just seeing how many pings are issued
  s = slGetStatus(4)
  SELECT CASE s
    CASE ""
      UpdateStatusBar "(" + FORMAT$(gCounter) + ") Ping: Returned nothing"
      tConnected = 0
    CASE "Yes"
      tConnected = 1
      UpdateStatusBar "(" + FORMAT$(gCounter) + ") Ping: Connected to " + gsIP
    CASE "No"
      tConnected = 0
      UpdateStatusBar "("+FORMAT$(gCounter) + ") Ping: Not connected"
      Connect_OpenDataBase
    CASE ELSE
      UpdateStatusBar s
    END SELECT
END SUB

SUB UpdateStatusBar(sText AS STRING)
  LOCAL zText AS ASCIIZ * 80
  zText = TIME$ + " " + sText
  CONTROL SEND ghDlg, %STATUSBAR, %SB_SETTEXT, 0, VARPTR(zText)
END SUB
                     

cj

October 28, 2011, 10:25:09 AM #31 Last Edit: October 29, 2011, 11:18:07 AM by cj
slGetStatus does not keep connections alive
All 4 connections were dropped at 04:37:49

These 4 connections were "pinged" every 300 seconds (5-minutes)

Reconnect, re-open worked fine when "No" was returned
I will keep these connections running to see results of the next drop
Could the drop at 04:37:49 been prevented?

111028 013215 Conn #22 SK 440 192.168.1.6  internet
111028 013926 Conn #23 SK 440 192.168.1.6  internet
111028 014740 Conn #24 SK 440 192.168.1.6  intranet
111028 014842 Conn #25 SK 440 192.168.1.6  intranet
111028 043749 Dcon #25 Dropped                    intranet
111028 043749 Dcon #24 Dropped                    intranet
111028 043749 Dcon #22 Dropped                    internet
111028 043749 Dcon #23 Dropped                    internet
111028 043913 Conn #26 SK 440 192.168.1.6
111028 043928 Conn #27 SK 440 192.168.1.6
111028 044216 Conn #28 SK 440 192.168.1.6
111028 044241 Conn #29 SK 440 192.168.1.6


It is now 11:34 AM CST and all four application still work
The sqliteningserver.log now looks like this:

111028013215 Conn #22 SK 440 CJRIGHT192.168.1.6
111028013926 Conn #23 SK 440 CJRIGHT192.168.1.6
111028014740 Conn #24 SK 440 CJRIGHT192.168.1.6
111028014842 Conn #25 SK 440 CJRIGHT192.168.1.6
111028043749 Dcon #25 Dropped
111028043749 Dcon #24 Dropped
111028043749 Dcon #22 Dropped
111028043749 Dcon #23 Dropped
111028043913 Conn #26 SK 440 CJRIGHT192.168.1.6
111028043928 Conn #27 SK 440 CJRIGHT192.168.1.6
111028044216 Conn #28 SK 440 CJRIGHT192.168.1.6
111028044241 Conn #29 SK 440 CJRIGHT192.168.1.6
111028112346 Conn #30 SK 440 CJRIGHT192.168.1.7
111028112430 Conn #31 SK 440 CJRIGHT192.168.1.7
111028112525 Dcon #27 WentAway
111028112612 Dcon #28 WentAway
111028112637 Dcon #29 WentAway
111028112651 Dcon #26 WentAway
111028112718 Conn #32 SK 440 CJRIGHT192.168.1.7
111028112743 Conn #33 SK 440 CJRIGHT192.168.1.7

4 connections  have Dropped and WentAway, so far.

             Dcon -- followed by # and the TCP file number and one of the following:
                     Disconnect = Client issued slDisconnect.
                     Dropped    = Client process ended and the client OS correctly notified the server of that event.
                     WentAway   = Client process ended but the client OS did not notify the server of that event.
                     TimeOut    = Client is inactive (no real messages) longer than the ConnectionTimeOut value in the config file.
                     Killed     = Connection was ended via SQLiteningServerAdmin.
                     Error      = Unrecoverable error occurred.


111028 013215 Conn #22 SK 440 CJRIGHT192.168.1.6
111028 013926 Conn #23 SK 440 CJRIGHT192.168.1.6
111028 014740 Conn #24 SK 440 CJRIGHT192.168.1.6
111028 014842 Conn #25 SK 440 CJRIGHT192.168.1.6
111028 043749 Dcon #25 Dropped
111028 043749 Dcon #24 Dropped
111028 043749 Dcon #22 Dropped
111028 043749 Dcon #23 Dropped
111028 043913 Conn #26 SK 440 CJRIGHT192.168.1.6
111028 043928 Conn #27 SK 440 CJRIGHT192.168.1.6
111028 044216 Conn #28 SK 440 CJRIGHT192.168.1.6
111028 044241 Conn #29 SK 440 CJRIGHT192.168.1.6
111028 112346 Conn #30 SK 440 CJRIGHT192.168.1.7
111028 112430 Conn #31 SK 440 CJRIGHT192.168.1.7
111028 112525 Dcon #27 WentAway
111028 112612 Dcon #28 WentAway
111028 112637 Dcon #29 WentAway
111028 112651 Dcon #26 WentAway
111028 112718 Conn #32 SK 440 CJRIGHT192.168.1.7
111028 112743 Conn #33 SK 440 CJRIGHT192.168.1.7
-------------------------------------------------

Ping counter now at 189.  slGetStatus is sent every 5-minutes.
:)

Another drop occurred at: 16:37:49 and autoreconnect still working
111028145659 Dcon #44 Disconnected
111028145816 Conn #45 SK 440 CJRIGHT192.168.1.7
111028145930 Dcon #45 Disconnected
111028150252 Conn #46 SK 440 CJRIGHT192.168.1.7
111028151740 Dcon #46 Disconnected
111028151812 Conn #47 SK 440 CJRIGHT192.168.1.7
111028163749 Dcon #31 Dropped
111028163749 Dcon #32 Dropped
111028163749 Dcon #47 Dropped
111028163749 Dcon #30 Dropped
111028163749 Dcon #33 Dropped
111028163819 Conn #48 SK 440 CJRIGHT192.168.1.7
111028163848 Conn #49 SK 440 CJRIGHT192.168.1.7
111028163932 Conn #50 SK 440 CJRIGHT192.168.1.7
111028164220 Conn #51 SK 440 CJRIGHT192.168.1.7
111028164245 Conn #52 SK 440 CJRIGHT192.168.1.7
111028165721 Dcon #48 Disconnected

Ping counter now at 373.  slGetStatus is sent every 5-minutes.
:)

Another drop occurred at: 04:37:50 and autoreconnect still working
Accidently closed one of the over the internet connections.  Now 3 active.

111029043750 Dcon #52 Dropped
111029043750 Dcon #49 Dropped
111029043750 Dcon #51 Dropped
111029043750 Dcon #50 Dropped
111029043851 Conn #61 SK 440 CJRIGHT192.168.1.7
111029043935 Conn #62 SK 440 CJRIGHT192.168.1.7
111029044224 Conn #63 SK 440 CJRIGHT192.168.1.7
111029044248 Conn #64 SK 440 CJRIGHT192.168.1.7

Fredrick Ughimi

Hello Fred,

Quote
I will try to develop a different message for the -18 error in the next release.  Of course, if you are handling errors in your own code then you can display any message you want.  You could even re-connect it desired.

Error -18 is raring its head at every opportunity at the moment. I need to trap it. I need sample codes to do it and where to place the code.

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

Fred Meier

Error -18 can occur on any command that does TCP messages to the server. 
The most common are slSel, slGetRow, and slExe.  You can trap errors from
all those commands and take whatever action you desire.  If you have a
simple query (a slSel followed by 10 slGetRows) then you could maybe
re-connect, re-open, and re-sel.  But, I'm not sure what you could do in a
complex query/update where the error occurs after you have done some
queries and updates.

Can you determine from the SQLitening log what is causing the -18?
Are the TCP/IP traces/logs on the client and/or server that can help?

Maybe someone who is a TCP/IP guru can help.


Rolf Brandt

How are you connected to the network? Cable connection, WLAN, or internet?

Rolf
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fredrick Ughimi

Hello Rolf,

Quote
How are you connected to the network? Cable connection, WLAN, or internet?

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

Fredrick Ughimi

Fred,

Quote
The most common are slSel, slGetRow, and slExe.  You can trap errors from
all those commands and take whatever action you desire.

Whao. I have plenty of those. It would be nice to do this at the server level. Just need an interim temporary solution: Would be ok?


    If Val(sErr) = -18 Then
         
      MsgBox "Disconnected!Your System Has been idle for over 30 minutes. Re-start the program to continue", %MB_TASKMODAL Or %MB_ICONINFORMATION, VD_App.Title 
         
    End If

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

Fred Meier

Not sure I understand when you say "to do this at the server level". 
SQLiteingServer runs as a service on the server and can't display messages. 
Services have no user. 

If you want the message that SQLitening.Dll displays when error -18
occurs, just re-compile SQLitening.Bas changing the text that error -18
displays in the routine called slGetError. 

Rolf Brandt

With cable connection there really should be no connection problems. I sometimes experience them with interntet connections.

Rolf
I like to cook with wine - sometimes I even add it to the food.
www.rbsoft.eu

Fredrick Ughimi

Rolf,

Quote
With cable connection there really should be no connection problems. I sometimes experience them with interntet connections.

Though the network is also connected to the internet (any computer on the network can connect to the internet), but I don't use the internet connection. Just the LAN.
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet

cj

I have started getting the same timeouts even with -1.
When they occur, I will just reconnect.

Fredrick Ughimi

Hello CJ,


I have started getting the same timeouts even with -1.


Same here.


When they occur, I will just reconnect.
[code]

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

cj

Something like this:

%ID_TIMER             = 500   'must be in the same thread so using a timer
SetTimer(CB.HNDL, %ID_Timer, 30000, BYVAL %NULL)  'check every 30 seconds

FUNCTION AutoStart(hDlg AS DWORD)  AS LONG
  ConnectToServer   hDlg
  OpenDatabase      hDlg
END FUNCTION

CASE %WM_DESTROY
  PostQuitMessage 0
  FUNCTION = 0
  KillTimer CB.HNDL, %ID_TIMER
  EXIT FUNCTION

CASE %WM_TIMER
  CALL Ping(CB.HNDL)

FUNCTION Ping(hDlg AS DWORD) AS LONG
  LOCAL s AS STRING
  s = slGetStatus(4)
  IF s <> "Yes" THEN
     AutoStart(hDlg)
  END IF
END FUNCTION








                         

cj

January 04, 2013, 09:25:33 PM #43 Last Edit: January 04, 2013, 10:19:16 PM by cj
Fredrick,
Would you check your SqliteningServer.log and see if the IP address is changing.
This is something that is causing -18 errors.

The IP address of the client changed at 18:11:11 from 192.168.1.6 to 192.168.1.7   
The ConnectTest.exe program below automatically reconnected to 192.168.1.2  and
a second ConnectTest.exe using the remote ip address also reconnected to 192.168.1.2.
This did not affect the 2 ConnectTest.exe programs running on the server.

Post #31 (from over a year ago) shows the same thing.
Why is the IP address changing?

Running 2 ConnectTest.exe checkers (see below) on the server and 2 ConnectTest.exe on the client.
The local ip address and the remote ip address are being checked on both computers.

Connection #493 and #494 were reconnected as #495 and #496 and connection #493 and #494 WentAway.

slGetStatus(4) <> "Yes" check every 1-minute

130104 161231 Dcon #445 Dropped    SERVER LOCAL IP   192.168.1.2
130104 161231 Dcon #448 Dropped    REMOTE LOCAL IP   192.168.1.2


130104 173708 Conn #491 SK 424     SERVER LOCAL IP   192.168.1.2
130104 173709 Conn #492 SK 424     SERVER INTERNET   192.168.1.2
130104 173709 Conn #493 SK 424     REMOTE LOCAL IP   192.168.1.6
130104 173710 Conn #494 SK 424     REMOTE INTERNET   192.168.1.6

       181111      #493   slGetStatus<>"Yes"         196.128.1.6
       181111      #494   slGetStatus<>"Yes"         192.168.1.6                     
130104 181111 Conn #495 SK 424     REMOTE LOCAL IP   192.168.1.7 New IP
130104 181111 Conn #496 SK 424     REMOTE INTERNET   192.168.1.7 New IP

130104 181403 Dcon #493 WentAway   REMOTE LOCAL IP   192.168.1.6
130104 181404 Dcon #494 WentAway   REMOTE INTERNET   192.168.1.6


Note: The server has run for a very long time and has never had a problem.

ConnectTest program with auto restart:

#COMPILE EXE "\sql\bin\ConnectTest"
#DIM ALL
#INCLUDE "\sql\inc\sqlitening.inc"
GLOBAL ghDlg, gPingCount AS DWORD
$IP = "192.168.1.2" 'change this
%PortNumber = 51234 'change this
%ID_TIMER = 500
%PingInSeconds = 60 'check slGetStatus(4) <> $Yes
$Yes="Yes"

%USEMACROS = 1
#INCLUDE ONCE "WIN32API.INC"
%IDD_CONNECTTEST =  101
%LISTBOX     = 1001

FUNCTION PBMAIN()
    CreateConnectTest %HWND_DESKTOP
END FUNCTION

CALLBACK FUNCTION ConnectTestProc()

  SELECT CASE AS LONG CB.MSG
    CASE %WM_INITDIALOG
      ghDlg = CB.HNDL
      ConnectToServer
      SetTimer(CB.HNDL, %ID_Timer, 1000, BYVAL %NULL)  'change time every second see if 60 seconds
    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_COMMAND
    '  SELECT CASE AS LONG CB.CTL
    '  END SELECT

    CASE %WM_DESTROY
      PostQuitMessage 0
      FUNCTION = 0
      KillTimer CB.HNDL, %ID_TIMER
      slDisconnect
      EXIT FUNCTION

    CASE %WM_TIMER
       CALL TimerSub

  END SELECT
END FUNCTION

FUNCTION CreateConnectTest(BYVAL hParent AS DWORD) AS LONG
  LOCAL lRslt AS LONG
  LOCAL hDlg  AS DWORD
  DIALOG NEW hParent, "Connect Test", 0,0, 201, 92, %WS_POPUP OR _
    %WS_BORDER OR %WS_DLGFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
    %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX 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

  CONTROL ADD LISTBOX, hDlg, %LISTBOX, , 0, 0, 200, 100, %WS_CHILD OR _
    %WS_VISIBLE OR %WS_VSCROLL OR %LBS_NOTIFY, _
    %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
    %WS_EX_RIGHTSCROLLBAR

  DIALOG SHOW MODAL hDlg, CALL ConnectTestProc TO lRslt

  FUNCTION = lRslt
END FUNCTION

FUNCTION AutoStart AS LONG
  'Add any startup code needed here
  ConnectToServer
END FUNCTION

SUB TimerSub
  STATIC counter AS LONG
  STATIC s AS STRING * 40
  s =  "Connect Test " + TIME$ + " " +STR$(%PingInSeconds-counter) + "     Pings" + STR$(gPingCount)
  DIALOG SET TEXT ghDlg, s

  INCR counter
  IF counter > %PingInSeconds THEN
    counter = 0
    INCR gPingCount
    IF slGetStatus(4) <> $Yes THEN
      LISTBOX ADD ghDlg, %LISTBOX, "CONNECT ERROR AT "+ DATE$ + " " + TIME$
      AutoStart
    END IF
  END IF
END SUB

FUNCTION ConnectToServer AS LONG
  LOCAL Attempt,Result AS LONG

  FOR Attempt = 1 TO 3 'retries
    result = slConnect($IP,%PortNumber)
    LISTBOX ADD ghDlg, %LISTBOX, "Connect result" + STR$(result) + " at " + TIME$
    IF result = 0 THEN
       EXIT FUNCTION
    END IF
    BEEP
    SLEEP 1000
  NEXT
  FUNCTION = Result
END FUNCTION

cj

I have been running ConnectTest above on a server for days and
connections drop on the server at 03:18:48 and 15:18:48 everyday.
I believe someone already posted something about this.