Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Sporadic problems at login via script

PLKM
2017-04-19
2017-05-03
  • PLKM - 2017-04-19

    For our controllers with more functionality (more time to compile and generate code) i have sporadic problems with the login function, which returns sometimes with an exception. It seems that there is a timing problem within the function:

    Good case:
    Skript Meldungen: Information: codesysServerScript.py(464 in download_and_run@443): online_application.login(OnlineChangeOption.Never, True)
    Übersetzen: Text: C0: ------ Build started: Application: DeviceUnderTest.Application -------
    Übersetzen: Text: C0: The application is up to date
    Übersetzen: Text: C0: Kompilierung abgeschlossen -- 0 Fehler, 0 Warnungen
    Übersetzen: Text: C0: ------ Build started: Application: DeviceUnderTest.Application -------
    Übersetzen: Text: C0: The application is up to date
    Übersetzen: Text: C0: generate code...
    Übersetzen: Text: C0: generate global initializations ...
    Übersetzen: Text: C0: generate code initialization ...
    Übersetzen: Text: C0: generate relocations ...
    Übersetzen: Information: C0: Size of generated code: 77820 bytes
    Übersetzen: Information: C0: Size of global data: 16318 bytes
    Übersetzen: Information: C0: Total allocated memory size for code and data: 120272 bytes
    Übersetzen: Information: C0: Memory area 0 contains Data, Input, Output, Memory and Nonsafe Data: size: 131072 bytes, highest used address: 42432, largest contiguous memory gap: 88640 bytes (67 %)
    Übersetzen: Information: C0: Memory area 1 contains Code: size: 131072 bytes, highest used address: 77840, largest contiguous memory gap: 53232 bytes (40 %)
    Übersetzen: Text: C0: Build complete -- 0 errors, 0 warnings : ready for download!

    Bad case:
    Skript Meldungen: Information: codesysServerScript.py(464 in download_and_run@443): online_application.login(OnlineChangeOption.Never, True)
    Übersetzen: Text: C0: ------ Build started: Application: DeviceUnderTest.Application -------
    Übersetzen: Text: C0: typify code ...
    Übersetzen: Text: C0: Kompilierung abgeschlossen -- 0 Fehler, 0 Warnungen
    Skript Meldungen: Information: codesysServerScript.py(464 in download_and_run@443): Ausnahmefehler (<type 'exceptions.exception'="">, Exception('Einloggen fehlgeschlagen...',), <traceback object="" at="" 0x000000000000008e="">)</traceback></type>

    For workaround i run the function 3 or 4 times in a row.

    It never happend with the GUI.

     
  • mkeller - 2017-04-19

    Hi PLKM.

    PLKM hat geschrieben:
    For our controllers with more functionality (more time to compile and generate code) i have sporadic problems with the login function, which returns sometimes with an exception. It seems that there is a timing problem within the function:
    Bad case:
    Skript Meldungen: Information: codesysServerScript.py(464 in download_and_run@443): online_application.login(OnlineChangeOption.Never, True)
    Übersetzen: Text: C0: ------ Build started: Application: DeviceUnderTest.Application -------
    Übersetzen: Text: C0: typify code ...
    Übersetzen: Text: C0: Kompilierung abgeschlossen -- 0 Fehler, 0 Warnungen
    Skript Meldungen: Information: codesysServerScript.py(464 in download_and_run@443): Ausnahmefehler (<type 'exceptions.exception'="">, Exception('Einloggen fehlgeschlagen...',), <traceback object="" at="" 0x000000000000008e="">)
    For workaround i run the function 3 or 4 times in a row.
    It never happend with the GUI.</traceback></type>

    Which version of CODESYS do you use? Is the project just loaded before the login?

    Instead of repeating the login you can try to add a delay with before the login. For the start I would use 5000ms and reduce it step by step if it works.

    BR
    Martin

     
  • PLKM - 2017-04-20

    I use SP10 Patch 1 and there is no interaction with CODESYS at least 15 seconds before the login method.

    I already tried it with System.Delay(x) before the login, but the failure still exists.

    If i pregenerate the code with the generate_code() method it seems to be better, but the failure is still available sporadically.

     
  • mkeller - 2017-04-21

    Hi PLKM.

    PLKM hat geschrieben:
    I already tried it with System.Delay(x) before the login, but the failure still exists.
    If i pregenerate the code with the generate_code() method it seems to be better, but the failure is still available sporadically.

    You can try to use in combination with . There are a few things in CODESYS which are executed with the Idle event. Call and a few times before the login.

    If that does not help we could have a problem in the noUI mode which we need to investigate.

    import clr
    clr.AddReference("System.Windows.Forms")
    from System.Windows.Forms import Application
    from System import EventArgs
    Application.RaiseIdle(EventArgs.Empty)
    

    What is your Use Case for using the noUI mode?

    BR
    Martin

     
  • PLKM - 2017-05-03

    M.Keller hat geschrieben:
    Hi PLKM.
    You can try to use in combination with . There are a few things in CODESYS which are executed with the Idle event. Call and a few times before the login.
    If that does not help we could have a problem in the noUI mode which we need to investigate.

    import clr
    clr.AddReference("System.Windows.Forms")
    from System.Windows.Forms import Application
    from System import EventArgs
    Application.RaiseIdle(EventArgs.Empty)
    

    What is your Use Case for using the noUI mode?
    BR
    Martin

    The RaiseIdle Method seems to help. I will do some more tests in the next days.

    The noUI mode is for automated tests for our controllers, which are running in the background.

     

Log in to post a comment.