Jump to content

ff.au3 mozrepl error


Go to solution Solved by Iczer,

Recommended Posts

Occasionally when running an exe halfway through the exe I'm getting the error

ff.au3 error

__FFWaitForRepl ==> Error TCPSend /TCPRecv :-1

There seems no consistency, sometimes I do get this but sometimes I don't.

What does this mean and how I could rectify it?

Problem only seems to only occur on scripts thats been made into an exe file, but when run the script itself by pressing F5 on SCiTE, it is fine there.

Is this a connection related issue?

Link to comment
Share on other sites

  • Solution

it very annoying bug #2596 as it blocking script execution, so i went ahead and make some changes in FF udf (it is only appearance of TCPRecv() in udf):

; #INTERNAL_USE_ONLY# ==========================================================
; Name ..........: __FFWaitForRepl
; Description ...:
; AutoIt Version : V3.3.0.0
; Syntax ........: __FFWaitForRepl($iTimeOut)
; Parameter(s): .: $iTimeOut
; Return Value ..: Success      - Return value from MozRepl
;                  Failure      - ""
;                  @ERROR       -
; Author(s) .....: Thorsten Willert
; Date ..........: Fri Dec 04 11:48:08 CET 2009
; ==============================================================================
Func __FFWaitForRepl($iTimeOut)
    Local Const $sFuncName = @CRLF & "__FFWaitForRepl"

    Local $recv, $sRet = "", $TimeOutTimer = TimerInit()
    If $iTimeOut < 200 Then $iTimeOut = 200

    While TimerDiff($TimeOutTimer) < $iTimeOut

        ; connection delay
        Sleep($_FF_CON_DELAY)

        $recv = TCPRecv($_FF_GLOBAL_SOCKET, 4096)
        ;ConsoleWrite($recv & @CRLF)
        ; TCP error
        If @error > 0 Then;If @error Then  <<<<----------------------------------------------------------------------------
            SetError(__FFError($sFuncName, $_FF_ERROR_SendRecv, "TCPRecv :" & @error))
            Return ""
        EndIf
        $sRet &= $recv

        ; error from MozRepl
        If StringRegExp($recv, "!!!(.*?)(TypeError|Exception|ReferenceError):?") Then
            $recv = StringLeft($recv, StringInStr($recv, "location") - 1)
            Sleep(200)
            SetError(__FFError($sFuncName, $_FF_ERROR_ReplException, StringStripWS($recv, 3)))
            __FFSend(";") ; MozRepl-Reset
            Sleep(200)
            Return ""
        ElseIf StringInStr($recv, "....>") Then
            __FFSend(";") ; MozRepl-Reset
            Sleep(200)
            SetError(__FFError($sFuncName, $_FF_ERROR_RetValue, "MozRepl ....>"))
            Return ""
        ElseIf StringInStr($recv, "beginning of the line to force evaluation") Then
            Sleep(500) ; first connection delay
        EndIf

        ; multiple connections to MozRepl (e.g repl2?> ...)
        If StringRegExp($recv, "repl[\d]*>") Then Return StringRegExpReplace($sRet, "repl[\d]*>", "")
    WEnd

    ; Timeout
    SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, Round(TimerDiff($TimeOutTimer)) & "ms > " & $iTimeOut & "ms $iTimeOut"))
    Return ""

EndFunc   ;==>__FFWaitForRepl
Link to comment
Share on other sites

 

it very annoying bug #2596 as it blocking script execution, so i went ahead and make some changes in FF udf (it is only appearance of TCPRecv() in udf):

; #INTERNAL_USE_ONLY# ==========================================================
; Name ..........: __FFWaitForRepl
; Description ...:
; AutoIt Version : V3.3.0.0
; Syntax ........: __FFWaitForRepl($iTimeOut)
; Parameter(s): .: $iTimeOut
; Return Value ..: Success      - Return value from MozRepl
;                  Failure      - ""
;                  @ERROR       -
; Author(s) .....: Thorsten Willert
; Date ..........: Fri Dec 04 11:48:08 CET 2009
; ==============================================================================
Func __FFWaitForRepl($iTimeOut)
    Local Const $sFuncName = @CRLF & "__FFWaitForRepl"

    Local $recv, $sRet = "", $TimeOutTimer = TimerInit()
    If $iTimeOut < 200 Then $iTimeOut = 200

    While TimerDiff($TimeOutTimer) < $iTimeOut

        ; connection delay
        Sleep($_FF_CON_DELAY)

        $recv = TCPRecv($_FF_GLOBAL_SOCKET, 4096)
        ;ConsoleWrite($recv & @CRLF)
        ; TCP error
        If @error > 0 Then;If @error Then  <<<<----------------------------------------------------------------------------
            SetError(__FFError($sFuncName, $_FF_ERROR_SendRecv, "TCPRecv :" & @error))
            Return ""
        EndIf
        $sRet &= $recv

        ; error from MozRepl
        If StringRegExp($recv, "!!!(.*?)(TypeError|Exception|ReferenceError):?") Then
            $recv = StringLeft($recv, StringInStr($recv, "location") - 1)
            Sleep(200)
            SetError(__FFError($sFuncName, $_FF_ERROR_ReplException, StringStripWS($recv, 3)))
            __FFSend(";") ; MozRepl-Reset
            Sleep(200)
            Return ""
        ElseIf StringInStr($recv, "....>") Then
            __FFSend(";") ; MozRepl-Reset
            Sleep(200)
            SetError(__FFError($sFuncName, $_FF_ERROR_RetValue, "MozRepl ....>"))
            Return ""
        ElseIf StringInStr($recv, "beginning of the line to force evaluation") Then
            Sleep(500) ; first connection delay
        EndIf

        ; multiple connections to MozRepl (e.g repl2?> ...)
        If StringRegExp($recv, "repl[\d]*>") Then Return StringRegExpReplace($sRet, "repl[\d]*>", "")
    WEnd

    ; Timeout
    SetError(__FFError($sFuncName, $_FF_ERROR_Timeout, Round(TimerDiff($TimeOutTimer)) & "ms > " & $iTimeOut & "ms $iTimeOut"))
    Return ""

EndFunc   ;==>__FFWaitForRepl

I amended ff.au3 and rebuilt the exe file and it seems to have done the trick.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...