[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like Python 2.7 is inaffected by the bug:

static int
BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
{
...
#ifdef WITH_THREAD
if (!self->lock) {
self->lock = PyThread_allocate_lock();
}

if (!self->lock) {
PyErr_SetString(PyExc_MemoryError, "unable to allocate lock");
goto error;
}
#endif
...
}

I fixed the leak in Python 3.6, 3.7 and master. I close the issue.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1094891b2e3eafef464819acd4cd04cfd2b59661 by Victor Stinner in 
branch '3.6':
bpo-33916: Fix bz2 and lzma init when called twice (GH-7843) (GH-7872)
https://github.com/python/cpython/commit/1094891b2e3eafef464819acd4cd04cfd2b59661


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset efc6bf66a58e96c12116d65984ac69b0f36f85de by Miss Islington (bot) 
in branch '3.7':
bpo-33916: Fix bz2 and lzma init when called twice (GH-7843)
https://github.com/python/cpython/commit/efc6bf66a58e96c12116d65984ac69b0f36f85de


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7479

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7478

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9b7cf757213cf4d7ae1d436d86ad53f5ba362d55 by Victor Stinner in 
branch 'master':
bpo-33916: Fix bz2 and lzma init when called twice (GH-7843)
https://github.com/python/cpython/commit/9b7cf757213cf4d7ae1d436d86ad53f5ba362d55


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-21 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7453

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
pull_requests: +7435
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I four times tried to update this issue, and only the forth one was successful. 
Other attempts was failed because "Edit Error: someone else has edited this 
issue (nosy, components, versions)." This is an extreme case of race condition 
in real life.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Tests
nosy: +serhiy.storchaka
versions: +Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like test_bz2 has the same issue, but I'm not sure:
https://github.com/python/cpython/pull/7827#issuecomment-398810849

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread STINNER Victor


STINNER Victor  added the comment:

> This seems leak some resource.  But I'm not sure this lock contains refcnt on 
> Windows.

PR 7827 checks for leaks of Windows handles, this issue is about Windows 
handles, not Python reference leaks. But a Windows lock may use a Windows 
handle internally, I don't know :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread Zackery Spytz


Zackery Spytz  added the comment:

Have a look at #23224 and PR 7822.

--
nosy: +ZackerySpytz

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread INADA Naoki


INADA Naoki  added the comment:

In _lzmamodule.c

self->lock = PyThread_allocate_lock();

This seems leak some resource.  But I'm not sure this lock contains refcnt on 
Windows.

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-20 Thread STINNER Victor


New submission from STINNER Victor :

Using my PR 7827, I saw that test_refleaks_in_decompressor___init__() of 
test_lzma leaks 100 handles on Windows.

Extract of the code:

@support.refcount_test
def test_refleaks_in_decompressor___init__(self):
gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
lzd = LZMADecompressor()
refs_before = gettotalrefcount()
for i in range(100):
lzd.__init__()
self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)


The test comes from bpo-31787: commit d019bc8319ea35e93bf4baa38098ff1b57cd3ee5.

--
components: Windows
messages: 320087
nosy: paul.moore, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on 
Windows
type: resource usage
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com