From: Aleksey Avdeev <solo@solin.spb.ru>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] Q: [python3-3.3.1] RLIMIT в hasher`е
Date: Thu, 11 Apr 2013 16:51:28 +0400
Message-ID: <5166B1D0.4000602@solin.spb.ru> (raw)
In-Reply-To: <20130410173918.GB11748@altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 5378 bytes --]
10.04.2013 21:39, Dmitry V. Levin пишет:
> On Wed, Apr 10, 2013 at 09:06:04PM +0400, Aleksey Avdeev wrote:
>> 10.04.2013 19:47, Dmitry V. Levin пишет:
>>> On Wed, Apr 10, 2013 at 06:41:36PM +0400, Aleksey Avdeev wrote:
>>>> 10.04.2013 17:45, Dmitry V. Levin пишет:
>>>>> On Wed, Apr 10, 2013 at 05:36:15PM +0400, Aleksey Avdeev wrote:
>>>>>> 10.04.2013 16:53, Dmitry V. Levin пишет:
>>>>>>> On Wed, Apr 10, 2013 at 01:11:56PM +0400, Aleksey Avdeev wrote:
>>>>>>>> Приветствую.
>>>>>>>>
>>>>>>>> Я правильно понимаю, что установка пользовательским процессом RLIMIT
>>>>>>>> в 1000000, запрещена настройками hasher`а?
>>>>>>>
>>>>>>> $ hsh-run -- sh -c 'ulimit -Ha'
>>>>>>> core file size (blocks, -c) unlimited
>>>>>>> data seg size (kbytes, -d) unlimited
>>>>>>> scheduling priority (-e) 0
>>>>>>> file size (blocks, -f) unlimited
>>>>>>> pending signals (-i) 1032915
>>>>>>> max locked memory (kbytes, -l) 64
>>>>>>> max memory size (kbytes, -m) unlimited
>>>>>>> open files (-n) 4096
>>>>>>> pipe size (512 bytes, -p) 8
>>>>>>> POSIX message queues (bytes, -q) 819200
>>>>>>> real-time priority (-r) 0
>>>>>>> stack size (kbytes, -s) unlimited
>>>>>>> cpu time (seconds, -t) 7260
>>>>>>> max user processes (-u) 1024
>>>>>>> virtual memory (kbytes, -v) unlimited
>>>>>>> file locks (-x) unlimited
>>>>>>>
>>>>>>> Привысить значения этих hard limits ядро не даст.
>>>>>>>
>>>>>>>> PS: В Python-3.3.1 такую операцию пытается сделать
>>>>>>>> test.test_resource.ResourceTest. Если у нас это запрещено -- отключу тест.
>>>>>>>
>>>>>>> Какой именно лимит?
>>>>>>
>>>>>> В коде (см.
>>>>>> <http://git.altlinux.org/people/solo/packages/?p=python3.git;a=blob;f=python3/Lib/test/test_resource.py;h=f3416b7b43ef2db9094401f65abe78222af7746a;hb=001b4a54de71226a2f7e0d9f5a409774a686effd>):
>>>>>>
>>>>>> # Issue 6083: Reference counting bug
>>>>>> def test_setrusage_refcount(self):
>>>>>> try:
>>>>>> limits = resource.getrlimit(resource.RLIMIT_CPU)
>>>>>> except AttributeError:
>>>>>> pass
>>>>>> else:
>>>>>> class BadSequence:
>>>>>> def __len__(self):
>>>>>> return 2
>>>>>> def __getitem__(self, key):
>>>>>> if key in (0, 1):
>>>>>> return len(tuple(range(1000000)))
>>>> ^^^^^^^
>>>>>> raise IndexError
>>>>>>
>>>>>> resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
>>>>>
>>>>> И какие значения RLIMIT_CPU в результате пытается установить этот код?
>>>>
>>>> 1000000 (см. выделение).
>>>>
>>>> Там в конечном итоге setrlimit(resource, &rl)(см. функцию
>>>> resource_setrlimit(PyObject *self, PyObject *args) в
>>>> <http://git.altlinux.org/people/solo/packages/?p=python3.git;a=blob;f=python3/Modules/resource.c;h=b294a8cfe169bbc209e7e183b2eedbe018ed14b0;hb=001b4a54de71226a2f7e0d9f5a409774a686effd>)
>>>> возвращает errno == EPERM.
>>>
>>> Сколько значений RLIMIT_CPU передается в одном вызове setrlimit?
>>> Какие значения RLIMIT_CPU в результате пытается установить этот код?
>>
>> Вызов происходит так:
>>
>> setrlimit(resource, &rl)
>>
>> где:
>>
>> resource = 0 (константа RLIMIT_CPU из /usr/include/bits/resource.h)
>>
>> rl -- структура, содержащая:
>>
>> rl.rlim_cur = 1000000
>>
>> rl.rlim_max = 1000000
>
> Верно.
>
>>> На какое поведение setrlimit рассчитывает этот тест?
>>
>> Что setrlimit(resource, &rl) вернёт нечто отличное от -1.
>
> Верно.
>
>>> Что вообще тестирует тест по имени test_setrusage_refcount?
>>
>> Похоже он проверяет работоспособность вызова setrlimit (судя по коду).
>
> Неверно.
Это не важно, т. к., судя по логу, проблема именно в возврате -1,
вызовом setrlimit. В логе:
======================================================================
ERROR: test_setrusage_refcount (test.test_resource.ResourceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/src/RPM/BUILD/python3-3.3.1/Lib/test/test_resource.py",
line 125, in test_setrusage_refcount
resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
ValueError: not allowed to raise maximum limit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
А строка "not allowed to raise maximum limit" присутствует только в:
if (setrlimit(resource, &rl) == -1) {
if (errno == EINVAL)
PyErr_SetString(PyExc_ValueError,
"current limit exceeds maximum limit");
else if (errno == EPERM)
PyErr_SetString(PyExc_ValueError,
"not allowed to raise maximum limit");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
else
PyErr_SetFromErrno(PyExc_OSError);
goto error;
}
Т. е. до вызова setrlimit, с указанными выше параметрами, дело
доходит. И корень проблемы в том, что он возвращает -1.
А смысл теста -- вещь, в данном контексте, десятая.
--
С уважением. Алексей.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]
next prev parent reply other threads:[~2013-04-11 12:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 9:11 Aleksey Avdeev
2013-04-10 12:53 ` Dmitry V. Levin
2013-04-10 13:36 ` Aleksey Avdeev
2013-04-10 13:45 ` Dmitry V. Levin
2013-04-10 14:41 ` Aleksey Avdeev
2013-04-10 15:47 ` Dmitry V. Levin
2013-04-10 17:06 ` Aleksey Avdeev
2013-04-10 17:39 ` Dmitry V. Levin
2013-04-11 12:51 ` Aleksey Avdeev [this message]
2013-04-11 13:02 ` Dmitry V. Levin
2013-04-10 19:10 ` Paul Wolneykien
2013-04-10 19:54 ` Aleksey Avdeev
2013-04-10 20:12 ` Dmitry V. Levin
2013-04-10 20:47 ` Aleksey Avdeev
2013-04-10 21:22 ` Dmitry V. Levin
2013-04-11 8:45 ` Sergey Y. Afonin
2013-04-11 11:48 ` Aleksey Avdeev
2013-04-11 11:55 ` Paul Wolneykien
2013-04-11 12:15 ` Aleksey Avdeev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5166B1D0.4000602@solin.spb.ru \
--to=solo@solin.spb.ru \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git