Welcome! Log In Create A New Profile

Advanced

RE: Sending a notification to the main nginx thread

October 07, 2021 11:18AM
> -----Original Message-----
> From: nginx-devel <nginx-devel-bounces@nginx.org> On Behalf Of Maxim Dounin
> Sent: Thursday, 7 October 2021 16:07
> To: nginx-devel@nginx.org
> Subject: Re: Sending a notification to the main nginx thread
>
> Hello!
>
> To re-iterate: inside a "side thread" you are not allowed to call any non-thread-safe libc functions. It is reasonable to assume this excludes all 3rd party libraries with their own even loops.

This is a valid point.

I checked it out, with the specific build options I'm using on Linux, these are the non-thread-safe libc functions used by nginx -
(list of all non-thread-safe functions taken from https://man7.org/linux/man-pages/man7/pthreads.7.html, assuming POSIX.1-2008) -

$ (objdump -T /usr/local/nginx/sbin/nginx | grep GLIBC | awk '{print $NF}' ; cat /tmp/libc-non-thread-safe) | sort | uniq -c | grep -vw 1
2 dlerror
2 getenv
2 getgrnam
2 getpwnam
2 localtime
2 strerror

First 4 functions are called only early on nginx startup from what I see, so not relevant in this context.
That leaves me only with strerror & localtime.

I verified these 2 functions are not used by the specific library I'm linking against.
So, assuming I don't use any nginx functions on the side thread (other than ngx_notify), it feels quite safe to me...

Thanks,

Eran

> --
> Maxim Dounin
> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmdounin.ru%2F&amp;data=04%7C01%7C%7C90afff8c33b442f4d52808d989936e28%7C0c503748de3f4e2597e26819d53a42b6%7C1%7C0%7C637692088574018462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lXE%2FhlbsINRDQkC722mGPme0ChawmmJp%2FVa6IPm2jrg%3D&amp;reserved=0
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailman.nginx.org%2Fmailman%2Flistinfo%2Fnginx-devel&amp;data=04%7C01%7C%7C90afff8c33b442f4d52808d989936e28%7C0c503748de3f4e2597e26819d53a42b6%7C1%7C0%7C637692088574018462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=OxEoMCuekC9H3MrYRAF2ZCxYWm%2BrLAs3R45BpQJsZ6w%3D&amp;reserved=0
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Sending a notification to the main nginx thread

erankor 242 October 05, 2021 10:06AM

Re: Sending a notification to the main nginx thread

Maxim Dounin 63 October 06, 2021 09:12AM

RE: Sending a notification to the main nginx thread

erankor 82 October 06, 2021 03:54PM

Re: Sending a notification to the main nginx thread

Maxim Dounin 93 October 07, 2021 09:08AM

RE: Sending a notification to the main nginx thread

erankor 79 October 07, 2021 11:18AM

Re: Sending a notification to the main nginx thread

Maxim Dounin 57 October 07, 2021 01:18PM

RE: Sending a notification to the main nginx thread

erankor 68 October 07, 2021 03:48PM

Re: Sending a notification to the main nginx thread

dnj0496 53 October 07, 2021 01:28PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready