William Allen Simpson wrote on Mon, Nov 06, 2017 at 08:12:19AM -0500:
> The only threads that I know of are fridge and work_pool.

There's quite a few more, just looking at the ones that do set their name:
$ git grep SetNameFunction 
src/FSAL/FSAL_GLUSTER/fsal_up.c:        SetNameFunction(thr_name);
src/FSAL/FSAL_GPFS/fsal_up.c:   SetNameFunction(thr_name);
src/FSAL/FSAL_PROXY/handle.c:   SetNameFunction("pxy_rcv_thread");
src/FSAL/FSAL_PROXY/handle.c:   SetNameFunction("pxy_clientid_renewer");
src/FSAL/FSAL_PROXY/handle_mapping/handle_mapping_db.c: 
SetNameFunction(thread_name);
src/FSAL/FSAL_PROXY/handle_mapping/test_handle_mapping.c: 
SetNameFunction("main");
src/FSAL/FSAL_PROXY/handle_mapping/test_handle_mapping_db.c: 
SetNameFunction("main");
src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_lru.c: 
SetNameFunction("cache_lru");
src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_lru.c: 
SetNameFunction("chunk_lru");
src/MainNFSD/9p_dispatcher.c:   SetNameFunction(my_name);
src/MainNFSD/9p_dispatcher.c:   SetNameFunction("_9p_disp");
src/MainNFSD/9p_rdma_dispatcher.c: SetNameFunction("_9p_rdma_disp");
src/MainNFSD/nfs_admin_thread.c:        SetNameFunction("Admin");
src/MainNFSD/nfs_init.c:        SetNameFunction("sigmgr");
src/MainNFSD/nfs_init.c:        SetNameFunction("main");
src/MainNFSD/nfs_reaper_thread.c:       SetNameFunction("reaper");
src/MainNFSD/nfs_worker_thread.c:       SetNameFunction(thr_name);
src/SAL/state_lock.c:   SetNameFunction("lk_poll");
src/dbus/dbus_heartbeat.c:      SetNameFunction("dbus_heartbeat");
src/dbus/dbus_server.c: SetNameFunction("dbus");
src/log/log_functions.c:void SetNameFunction(const char *nom)
src/support/delayed_exec.c:     SetNameFunction("Async");
src/support/fridgethr.c:        SetNameFunction(fr->s);


> If you've got come others in another library, they'll have to use the same
> library function.

Other FSALs are in other libraries, but given how it's setup they can
use that function and I understand ntirpc cannot use ganesha functions
directly :)

One way that'd work for example would be have ganesha provide a pointer
to SetNameFunction at init, it's a bit ugly though.


>>        As you can see the problem seems to be that the thread local
>> variable is not initialized, but I fail to see why this would
>> hang instead of returning garbage.
>
> That seems odd.  I defined the function so that a missing variable
> should return NULL.

It won't ever return NULL, but the string should be initialized with 0s
on first access.

I honestly do not understand why the thread-local-storage lock doesn't
give way at this point, it probably has to do with the first log message
from that thread ever being during the shutdown sequence... But given
that it does I do not see any way to make this work.

As far as I understand tls variables are allocated/initialized on first
access so even if you would try to stock another value on the thread
storage it would have the same problem :/


What I don't like with the current model, more than the hang itself, is
that if we start using other libraries that spawn threads (for example
if we start using the mooshika epoll threads to process requests for
9P/RDMA, which I think we will want to when we get rid of ganesha's
worker threads), then we'd need to add another imbricated if there to
figure the thread name.
It still works, but looking ahead this is likely going to become
spaghetti at some point...


>> I'll submit a patch that just sets thread names for now but
>> experiencing a hang there instead of some default value isn't
>> nice. Does anyone have an idea?
>
> Nope.  And no idea why you'd post this on an old patch, either.  The
> discussion will be lost.

This is the patch that introduces the regression, it's not because it
has been merged that we cannot discuss there: it won't be any more lost
than any other discussion there, folks involved with the patch get
notifications, etc.
Now you've moved it to the list let's continue here, but there is no
reason not to discuss on an old patch if that patch gives context to the
problem. You did see it as expected :)

-- 
Dominique

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nfs-ganesha-devel mailing list
Nfs-ganesha-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to