8000 python_runner.py should check the utf8 length to determine when to use stdin for parameters. · Issue #6331 · StackStorm/st2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

python_runner.py should check the utf8 length to determine when to use stdin for parameters. #6331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
guzzijones opened this issue Apr 29, 2025 · 0 comments

Comments

@guzzijones
Copy link
Contributor

SUMMARY

python_runner.py should check the utf8 length to determine when to use stdin for parameters.

Provide a quick summary of your bug report.

        # If parameter size is larger than the maximum allowed by Linux kernel
        # we need to swap to stdin to communicate parameters. This avoids a
        # failure to fork the wrapper process when using large parameters.
        stdin = None
        stdin_params = None
        lenencoded = len(serialized_parameters.encode("utf8"))
        LOG.debug(f"Parameters len encoded: {lenencoded}")
        if len(serialized_parameters) >= MAX_PARAM_LENGTH:
            stdin = subprocess.PIPE
            LOG.debug("Parameters are too big...changing to stdin")
            stdin_params = '{"parameters": %s}\n' % (serialized_parameters)
            args.append("--stdin-parameters")
        else:
            LOG.debug("Parameters are just right...adding them to arguments")
            args.append("--parameters=%s" % (serialized_parameters))

check against MAX_PARAM_LENGTH should use lenencoded . high bit character strings will end up longer than the length of the unicode string.

STACKSTORM VERSION

3.9

OS, environment, install method

all

Steps to reproduce the problem

use a string with high bit characters and a unicode string length > (131072 -15)

Expected Results

action runs without error

Actual Results

[Errno 7] Argument list too long: '/opt/stackstorm/virtualenvs/rt/bin/python'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0