[issue43832] asyncio + multiprocessing = core dump in sem_trywait

2021-06-29 Thread Kunal


Kunal  added the comment:

I was trying to reproduce the problem and can get the core dump to happen with 
a smaller program as well -- it doesn't seem related to asyncio specifically 
but seems to be a bug with multiprocessing.Event (or probably the primitives 
inside it).

```
#!/usr/bin/env python

import time
import multiprocessing


def master_func(event) -> None:
print(f"Child: {event = }")
print(f"Child: {event.is_set() = }") # Crashes here with SIGSEGV in 
sem_trywait
print("Completed")


if __name__ == "__main__":
event = multiprocessing.Event()
context_spawn = multiprocessing.get_context("spawn")
proc = context_spawn.Process(target=master_func, args=(event, ))
proc.start()
print(f"Parent: {event = }")
print(f"Parent: {event.is_set() = }")
proc.join()
```

Switching to fork instead of spawn bypasses the issue. Trying to dig into this 
a little bit more.

--
nosy: +knl

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



[issue43832] asyncio + multiprocessing = core dump in sem_trywait

2021-06-29 Thread Kunal


Kunal  added the comment:

Oh, it looks like it's because the context for the Event doesn't match when 
created this way (the default context on linux is fork). 

The problem goes away if the Event instance is created from the spawn context 
-- specifically, patching dump_core.py 

```
@@ -22,14 +22,13 @@ def master_func(space:dict) -> None:

 if __name__ == "__main__":

-this_event = multiprocessing.Event()
+context_spawn = multiprocessing.get_context("spawn")

+this_event = context_spawn.Event()
 this_space = dict(
 this_event=this_event,
 )

-context_spawn = multiprocessing.get_context("spawn")
-
 master_proc = context_spawn.Process(
```

I think this can be closed; the incompatibility between contexts is also 
documented at 
https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Lock, 
thought it could be a little more explicit about potential segfaults.

> Note that objects related to one context may not be compatible with processes 
> for a different context. In pait's berticular, locks created using the fork 
> context cannot be passed to processes started using the spawn or forkserver 
> start methods.

(Event uses a Lock under the hood)

--

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



[issue26302] cookies module allows commas in keys

2016-02-06 Thread Kunal Grover

Kunal Grover added the comment:

Hi, I am a newcomer here, I am interested to work on this issue.

--
nosy: +Kunal Grover

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



[issue26296] colorys rgb_to_hls algorithm error

2016-02-08 Thread Kunal Grover

Kunal Grover added the comment:

This isn't needed. We are taking modulus with 1.0, which already fixes negative 
values of h.

--
nosy: +Kunal Grover

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