From tixu@cs.ucsd.edu Mon Nov 26 09:27:52 2012 From: tixu@cs.ucsd.edu To: openldap-bugs@openldap.org Subject: Re: (ITS#7444) Check the return value of ldap_pvt_thread_set_concurrency Date: Mon, 26 Nov 2012 09:27:51 +0000 Message-ID: <201211260927.qAQ9Rpvf066240@boole.openldap.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0678494252296732180==" --===============0678494252296732180== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable --f46d04428c6e0fb88b04cf62891a Content-Type: text/plain; charset=3DISO-8859-1 On Sun, Nov 25, 2012 at 7:54 PM, Howard Chu wrote: > tixu(a)cs.ucsd.edu wrote: > >> Full_Name: Tianyin Xu >> Version: 2.4.33 >> OS: Ubuntu 12.04 (actually doesn't matter) >> URL: >> Submission from: (NULL) (2607:f720:1300:1241:590b:49c:**889f:7b21) >> >> >> Hi, all, >> >> Still the verbosity idea. In the current version of slapd, when handling >> users' >> "concurrency" setting, slapd does not check the return value of >> "ldap_pvt_thread_set_**concurrency" (essentially the return value of >> "pthread_setconcurrency") to see whether the setting is successful or not. >> >> So when the user setting is inappropriate (i.e., too big), slapd says >> nothing. >> But users have no way to be aware of such configuration failure. I >> suggest to >> check and notify users in this case. >> > > pthread_setconcurrency is a no-op on Linux systems. Even on systems where > this setting might have an effect, it is generally unused. We have more > important things to worry about than this. > > Yes, I understand that user configuration is never a high-priority issue. That's why I attached my patch which simply checks the return value, and prints out a log messge to notify users. The patch itself does not have any side effect to other part of code. I personally think the verbosity idea can improve the system reactions to users' configurations including this one and its #7443. It is safe (no side effect) and easy to do (simply adding some log messages), but can greatly improve the usability and friendlyness to configurations. If you agree, I'm happy to write patches and corresponding code. Thanks, Tianyin > Here's the patch: >> >> --- ../openldap-2.4.33/servers/**slapd/bconfig.c 2012-10-10 >> 05:18:49.000000000 -0700 >> +++ servers/slapd/bconfig.c 2012-11-16 14:52:37.211421828 -0800 >> @@ -1530,7 +1530,14 @@ >> break; >> >> case CFG_CONCUR: >> - ldap_pvt_thread_set_**concurrency(c->value_int); >> + >> + if(ldap_pvt_thread_set_**concurrency(c->value_int) >> !=3D 0) >> { >> + snprintf( c->cr_msg, sizeof( c->cr_msg ), >> + "concurrency=3D%d is not valid; >> using >> the default setting", >> + c->value_int ); >> + Debug(LDAP_DEBUG_ANY, "%s: %s.\n", >> c->log, >> c->cr_msg, 0 ); >> + >> + } >> break; >> >> case CFG_THREADS: >> >> >> >> > > -- > -- Howard Chu > CTO, Symas Corp. http://www.symas.com > Director, Highland Sun http://highlandsun.com/hyc/ > Chief Architect, OpenLDAP http://www.openldap.org/**project/ > --=20 Tianyin XU, http://cseweb.ucsd.edu/~tixu/ --f46d04428c6e0fb88b04cf62891a Content-Type: text/html; charset=3DISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Sun, Nov 25,= 2=3D 012 at 7:54 PM, Howard Chu <hyc(a)symas.com> wrote:
tix=3D u(a)cs.ucsd.edu wrote:
Full_Name: Tianyin Xu
Version: 2.4.33
OS: Ubuntu 12.04 (actually doesn't matter)
URL:
Submission from: (NULL) (2607:f720:1300:1241:590b:49c:889f:7b21)


Hi, all,

Still the verbosity idea. In the current version of slapd, when handling us=3D ers'
"concurrency" setting, slapd does not check the return value of "ldap_pvt_thread_set_concurrency" (essentially the return =3D value of
"pthread_setconcurrency") to see whether the setting is successfu=3D l or not.

So when the user setting is inappropriate (i.e., too big), slapd says nothi=3D ng.
But users have no way to be aware of such configuration failure. I suggest =3D to
check and notify users in this case.

pthread_setconcurrency is a no-op on Linux systems. Even on systems where t=3D his setting might have an effect, it is generally unused. We have more impo=3D rtant things to worry about than this.


Yes, I understand that user configuration is ne=3D ver a high-priority issue. That's why I attached my patch which simply =3D checks the return value, and prints out a log messge to notify users. The p=3D atch itself does not have any side effect to other part of code.

I personally think the verbosity idea can improve the system reactions =3D to users' configurations including this one and its #7443. It is safe (=3D no side effect) and easy to do (simply adding some log messages), but can g=3D reatly improve the usability and friendlyness to configurations. If you agr=3D ee, I'm happy to write patches and corresponding code.

Thanks,
Tianyin

=3DA0
Here's the patch:

--- ../openldap-2.4.33/servers/slapd/bconfig.c =3DA0 =3DA0 =3DA02012-1= 0-10=3D
05:18:49.000000000 -0700
+++ servers/slapd/bconfig.c =3DA0 =3DA0 2012-11-16 14:52:37.211421828 -0800 @@ -1530,7 +1530,14 @@
=3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0= break;

=3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0case CFG_CONCUR:
- =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 ldap_pvt_= thread_set_co=3D ncurrency(c->value_int);
+
+ =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0if(l= dap_pvt_thread_set_=3D concurrency(c->value_int) !=3D3D 0)
{
+ =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D= A0 =3DA0 =3DA0 snprintf( c-&=3D gt;cr_msg, sizeof( c->cr_msg ),
+ =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D= A0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D =3DA0 =3DA0 "concurrency=3D3D%d is not valid; using
the default setting",
+ =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D= A0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D =3DA0 =3DA0 c->value_int );
+ =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3D= A0 =3DA0 =3DA0 =3DA0Debug(LDAP=3D _DEBUG_ANY, "%s: %s.\n", c->log,
c->cr_msg, 0 );
+
+ =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 }
=3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0= break;

=3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 =3DA0case CFG_THREADS:





--
=3DA0 -- Howard Chu
=3DA0 CTO, Symas Corp. =3DA0 =3DA0 =3DA0 =3DA0 =3DA0 http://www.symas.com
=3DA0 Director, Highland Sun =3DA0 =3DA0 http://highlandsun.com/hyc/
=3DA0 Chief Architect, OpenLDAP =3DA0http://www.openldap.org/project/



--
Tian= =3D yin XU,
http://csew= eb=3D .ucsd.edu/~tixu/

--f46d04428c6e0fb88b04cf62891a-- --===============0678494252296732180==--