Sikulix subprocess module overflow error

Asked by abuzer stream

Hello,
We are writing tests for a large project using Sikulix. It helped us test many scenarios. But some of our tests are too long. At some point in these long tests, I think we're reaching the limits of the JVM and the test freezes. When we terminate the sikulix.jar process, the test continues from where it left off. At this point, I ask for your help. (I use thousands of images and static functions). I cannot detect the error.

I am using the subprocess module. And as far as I have determined, it freezes after running this function 218 times on a computer with 8 GB of RAM, 1180 times on a computer with 64 GB of RAM. I tried different operating systems (ubuntu, centos) same problem.
The communicate() function in the Subprocess module causes an overflow even though I terminate the process.

I am waiting for your help.

# -*- coding: utf-8 -*-
import subprocess

class window:
    @staticmethod
    def check():
          i = 0
          while True:
              print("i >>" +str(i))
              print("Start SUBPROCESS 1>>> ")
              p = subprocess.Popen("exec xdotool search 'window_name'", shell=True, stdout=subprocess.PIPE)
              print("END SUBPROCESS 1>>> ")
              print("start communicate 1>>> ")
              result = p.communicate()
              print("end communicate 1>>> ")
              p.terminate()
              print("end terminate 1>>> ")
              id = result[0]
              print("Start SUBPROCESS 2>>> ")
              p = subprocess.Popen("exec xdotool getwindowname 'wındow_pid'", shell=True, stdout=subprocess.PIPE)
              print("END SUBPROCESS 2>>> ")
              print("start communicate 2>>> ")
              result = p.communicate()
              print("end communicate 2>>> ")
              p.terminate()
              print("end terminate 2>>> ")
              x = result[0]
              i += 1

window.check()

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Surely not a SikuliX problem.

Try your approach with plain Jython.
I guess it is a problem with garbage collection might be together with the use of @staticmethod.

Your setup does not really make sense for me, since the result is not used outside of window.check() and the loop around the 2 subprocess calls run for ever.

Revision history for this message
abuzer stream (abuzerstream) said :
#2

Actually, the window.check() function is just an example here. We also get this error when we do not use the same function as static, and the loop is infinite just to create a function that can get the error quickly. Otherwise, it gives the same error when it runs 250 times on a machine with 16 GB RAM and 1200 times on a machine with 64 GB RAM.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Might be.

... but the only way, to get nearer is to run your stuff directly with Jython since there is no SikuliX feature involved.

Can you help with this problem?

Provide an answer of your own, or ask abuzer stream for more information if necessary.

To post a message you must log in.