Skip to content
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

Maximum message size exceeded on su in python3.7.1 #437

Closed
syntonym opened this issue Dec 8, 2018 · 7 comments
Closed

Maximum message size exceeded on su in python3.7.1 #437

syntonym opened this issue Dec 8, 2018 · 7 comments

Comments

@syntonym
Copy link

@syntonym syntonym commented Dec 8, 2018

Trying to use router.su leads me to the following error message on python 3.7.1:

E mitogen: Maximum message size exceeded (got 1768910423, max 134217728)

I tested against 0.2.0, 0.2.1, 0.2.2, 0.2.3 from pypi, and the current master branch (22de7f0), all with the same result. On python version 2.7.15 the same code does not through this error (only tested against 22de7f0).

su from util-linux 2.33 and kernel 4.19.4.arch1-1.

Code used:

import mitogen.utils
import getpass

mitogen.utils.log_to_file()
@mitogen.utils.run_with_router
def main(router):
    router.enable_debug()
    router.su(username="syntonym", password=getpass.getpass())
@dw
Copy link
Member

@dw dw commented Dec 9, 2018

Looks like somehow something is printing into the stream past the point where it should exclusively be used by the parent and child. 1768910423 in hex is 0x696f6e57, which is ASCII, "ionW".

Can you recognize that string? It might be printed perhaps by something imported by sitecustomize.py, usercustomize.py, or perhaps it is a PAM module invoked by su or similar.

Since bootstrap is completed, it seems more likely the corruption is by something within the Python interpreter, rather than PAM or bash or something.

Regardless, this is a bug because that error could be improved. It is a simple matter to include, say, 2 signature bytes in every message, and if they are incorrect, produce a more descriptive error message including a dump of whatever string was actually received.

Thanks for reporting this!

@dw
Copy link
Member

@dw dw commented Dec 9, 2018

Grepping /usr/lib/python3.6, I see "ionW" appears a lot in "DeprecationWarning" :) I will test more locally, looks like it is definitely a Mitogen issue

@dw
Copy link
Member

@dw dw commented Dec 9, 2018

I've got an Arch VM matching yours and I cannot reproduce this deprecation warning :S Does the target or source user have some bashrc perhaps, that sets some environment variables?

I'm thinking perhaps the warning is relating to a locale setting in the environment, i.e. LC_ALL, LANG etc., or some similar mechanism

@dw
Copy link
Member

@dw dw commented Dec 9, 2018

possibly related: #399

@dw
Copy link
Member

@dw dw commented Dec 9, 2018

I managed to reproduce it. It is indeed due to #399, and it only impacts su because su redirects its stderr into stdout in order to cope (IIRC) with FreeBSD.

dw added a commit that referenced this issue Dec 9, 2018
Closes #399, #437.
dw added a commit that referenced this issue Dec 9, 2018
@dw
Copy link
Member

@dw dw commented Dec 9, 2018

This is now on the master branch and will make it into the next release. To be updated when a new release is made, subscribe to https://networkgenomics.com/mail/mitogen-announce/

I will open a separate ticket to improve the stream corruption error messages.

Thanks for reporting this!

@dw dw closed this Dec 9, 2018
@syntonym
Copy link
Author

@syntonym syntonym commented Dec 9, 2018

I tested the current HEAD version and can confirm that the bug is fixed.

Thanks for the super quick bugfix! I did not expect such a quick answer, let alone a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants