This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author izbyshev
Recipients gregory.p.smith, izbyshev, patrick.mclean
Date 2020-10-25.12:30:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603629055.61.0.677699237141.issue42146@roundup.psfhosted.org>
In-reply-to
Content
The following test demonstrates the leak:

```
import subprocess

cwd = 'x' * 10**6
for __ in range(100):
    try:
        subprocess.call(['/xxx'], cwd=cwd, user=2**64)
    except OverflowError:
        pass

from resource import *
print(getrusage(RUSAGE_SELF).ru_maxrss)
```

The leak was introduced by bpo-36046. Previously, `cleanup:` label was not reachable after `cwd_obj2` was initialized at https://github.com/python/cpython/blob/492d513ccbebeec40a8ba85cbd894a027ca5b2b3/Modules/_posixsubprocess.c#L892

I'll submit a PR with a simple fix suitable for backporting to 3.9.

Also, I think it might make sense to unify the two almost-identical cleanup paths we have now. I'll follow up with another PR.
History
Date User Action Args
2020-10-25 12:30:55izbyshevsetrecipients: + izbyshev, gregory.p.smith, patrick.mclean
2020-10-25 12:30:55izbyshevsetmessageid: <1603629055.61.0.677699237141.issue42146@roundup.psfhosted.org>
2020-10-25 12:30:55izbyshevlinkissue42146 messages
2020-10-25 12:30:55izbyshevcreate