I suggest you re-read my suggestion a few emails back. Move handling of the 
entire curl handle to the uv thread with a queue, a muted and an async handle.


-Saúl

> On 5 Jun 2017, at 11:49, Przemysław Sobala <[email protected]> 
> wrote:
> 
> W dniu piątek, 2 czerwca 2017 15:33:24 UTC+2 użytkownik Przemysław Sobala 
> napisał:
>> 
>> I'm about to compile and try rr. Meanwhile I've run my code in the 
>> production environment and caught some segmentation faults. I'd be pleased 
>> if you take a look: 
>> https://docs.google.com/document/d/1hOX9FLcx5N6gdLQ-aAMwNpPqCzpfXqDKjNaHqFGGbSY/edit?usp=sharing
> 
> I've reviewed my design and revealed a potential flaw.
> As you can see in post #1 I've got 1 main thread with uv_loop running 
> continuously and request accepting threads that call curl_multi_add_handle.
> It turns out that curl_multi_add_handle calls start_timeout callback function 
> (see https://github.com/curl/curl/blob/master/docs/examples/multi-uv.c) that 
> calls uv_timer_start and uv_timer_stop.
> This log confirms that:
>                     <thread id>
> I0605 11:46:54.860105 22880 FileDownloader.cpp:107] File downloading loop 
> started
> I0605 11:47:03.028491 22883 FileDownloader.cpp:254] start timeout 0ms
> I0605 11:47:03.028506 22883 FileDownloader.cpp:265] /start timeout
> I0605 11:47:03.028512 22883 FileDownloader.cpp:103] Downloading 
> http://i.wp.pl/a/f/jpeg/37211/sarah-cover-photo-1280x.jpeg?i=0 -> 
> /tmp/ir.download
> I0605 11:47:03.029150 22880 FileDownloader.cpp:273] handle_socket (action: 2, 
> socket: 0)
> I0605 11:47:03.029168 22880 FileDownloader.cpp:303] /handle_socket
> I0605 11:47:03.029171 22880 FileDownloader.cpp:254] start timeout 0ms
> I0605 11:47:03.029173 22880 FileDownloader.cpp:265] /start timeout
> I0605 11:47:03.030094 22880 FileDownloader.cpp:273] handle_socket (action: 1, 
> socket: 0x7fc9d0002920)
> I0605 11:47:03.030102 22880 FileDownloader.cpp:303] /handle_socket
> I0605 11:47:03.030105 22880 FileDownloader.cpp:254] start timeout 199ms
> I0605 11:47:03.030107 22880 FileDownloader.cpp:265] /start timeout
> I0605 11:47:03.047816 22880 FileDownloader.cpp:273] handle_socket (action: 4, 
> socket: 0x7fc9d0002920)
> I0605 11:47:03.047832 22880 FileDownloader.cpp:303] /handle_socket
> I0605 11:47:03.047835 22880 FileDownloader.cpp:192] Finished 
> http://i.wp.pl/a/f/jpeg/37211/sarah-cover-photo-1280x.jpeg?i=0 (0 - No error, 
> code: 200, time: 19.287 ms, speed: 250303 kb/s)
> I0605 11:47:03.047858 22880 FileDownloader.cpp:254] start timeout -1ms
> I0605 11:47:03.047863 22880 FileDownloader.cpp:265] /start timeout
> 
> If I understand correctly these functions cannot be called simultaneously 
> from other threads with running uv_loop in main thread.
> How can I fix that? Should I use uv_async_send() to call uv_timer_start() and 
> uv_timer_stop()?
> 
> --
> Regards
> Przemysław Sobala
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "libuv" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/libuv.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to