Leak in rdma_get_cm_event on pthread_cancel?
When I want to stop the thread reading rdma events, I kill it with a pthread_cancel(), since it is blocked in a rdma_get_cm_event(). This causes a leak of the evt variable in the rdma_get_cm_event() function. Not a big deal, of course, but a couple of pthread_cleanup_push(free, evt) and pthread_cleanup_pop() should solve it.
Flavio
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines
When I want to stop the thread reading rdma events, I kill it with a
pthread_cancel(), since it is blocked in ardma_get_cm_event(). This causes a leak of the evt variable in therdma_get_cm_event()function. Not a big deal, of
course, but a couple ofpthread_cleanup_push(free, evt)andpthread_cleanup_pop()should solve it.
What version of the librdmacm are you using?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A8237325676E37-P5GAC/[email protected]
Il 1/13/2012 17:43 PM, Hefty, Sean ha scritto:
Quoted 8 lines
Quoted 6 lines
When I want to stop the thread reading rdma events, I kill it with a
pthread_cancel(), since it is blocked in ardma_get_cm_event(). This causes a leak of the evt variable in therdma_get_cm_event()function. Not a big deal, of
course, but a couple ofpthread_cleanup_push(free, evt)andpthread_cleanup_pop()should solve it.What version of the librdmacm are you using?
I'm using 1.0.13; I checked in 1.0.15 too, and the code appears to have the same structure. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Flavio Baronti
When I want to stop the thread reading rdma events, I kill it with a
pthread_cancel(), since it is blocked in ardma_get_cm_event(). This causes a leak of the evt variable in therdma_get_cm_event()function. Not a big deal, of course, but a couple ofpthread_cleanup_push(free, evt)andpthread_cleanup_pop()should solve it.
None of the IB libraries have been audited for posix async cancellation safety.
To do this work someone would have to review every call to determine if it is a cancelation point, and document this as part of the API.
Then review if any of the internal cancelation points in the cancelable functions require a resource clean up, and add it.
IHMO, cancelation should not be used with threads that call into the ib libraries.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20120113175925.GE6798-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Il 1/13/2012 18:59 PM, Jason Gunthorpe ha scritto:
Quoted 14 lines · Flavio Baronti
Quoted 6 lines
When I want to stop the thread reading rdma events, I kill it with a
pthread_cancel(), since it is blocked in ardma_get_cm_event(). This causes a leak of the evt variable in therdma_get_cm_event()function. Not a big deal, of course, but a couple ofpthread_cleanup_push(free, evt)andpthread_cleanup_pop()should solve it.None of the IB libraries have been audited for posix async cancellation safety.
To do this work someone would have to review every call to determine if it is a cancelation point, and document this as part of the API.
Quoted 8 lines
Then review if any of the internal cancelation points in the cancelable functions require a resource clean up, and add it.
IHMO, cancelation should not be used with threads that call into the ib libraries.
Jason
Ok, but what is then the proper way to stop a thread blocked on rdma_get_cm_event() (or on ibv_get_cq_event())?
Flavio
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 2 lines · Flavio Baronti
what is then the proper way to stop a thread blocked on
rdma_get_cm_event()(or onibv_get_cq_event())?
Oh, this is simple - don't get there... have your code
1. get the FDs associated with IB - which you can retrieve from librdmacm and from libibverbs
2. make them non blocking
3. add them to you select/poll FD group
Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAJZOPZ+ik7DdXJHbEyr-PKyOQ3yEoWa6H=rhEe4cwc__61DUrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 4 lines · Or Gerlitz
Quoted 2 lines · Flavio Baronti
what is then the proper way to stop a thread blocked on
rdma_get_cm_event()(or onibv_get_cq_event())?
Quoted 8 lines
Oh, this is simple - don't get there... have your code
1. get the FDs associated with IB - which you can retrieve from librdmacm and from libibverbs
2. make them non blocking
3. add them to you select/poll FD group
4. Use an eventfd or otherwise to break out of the select/poll loop and then exit your thread.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20120116223541.GA2892-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Il 1/16/2012 23:35 PM, Jason Gunthorpe ha scritto:
Quoted 10 lines · Or Gerlitz
Quoted 9 lines
Quoted 2 lines · Flavio Baronti
what is then the proper way to stop a thread blocked on
rdma_get_cm_event()(or onibv_get_cq_event())?Oh, this is simple - don't get there... have your code
1. get the FDs associated with IB - which you can retrieve from librdmacm and from libibverbs
Quoted 8 lines
Quoted 3 lines
2. make them non blocking
3. add them to you select/poll FD group
4. Use an eventfd or otherwise to break out of the select/poll loop and then exit your thread.
Jason
Thanks, I did not think about eventfd+select.
Flavio
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html