[CDRIVER-4545] Heartbeat poll cannot be canceled Created: 17/Dec/22 Updated: 10/Feb/23 |
|
| Status: | Backlog |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.23.1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Unknown |
| Reporter: | Valentin Garaschuk | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | techdebt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | Improve Developer Experience |
| Description |
| Comments |
| Comment by Rishabh Bisht [ 10/Feb/23 ] |
|
Thanks for the additional info, Valentin! This is helpful. |
| Comment by Valentin Garaschuk [ 10/Feb/23 ] |
|
Hi Rishabh, unfortunately I was not able to use mongoc-interrupt-private.h. Once I try to include it, it also includes other headers, which trigger compilation error that says something like "this header can only be included via mongoc.h. However mongoc.h itself does not include mongoc-interrupt-private.h. Also the functions in mongoc-interrupt-private.h are not exported, so I cannot import them from a binary. Also my project links mongocxx, it does not use mongoc directly, so it makes the matter even more complicated. However, it looks like the code in mongoc-interrupt-private.h does exactly what I need. So it would be nice if it was automatically triggered by mongoc when the poll needs to be interrupted. |
| Comment by Rishabh Bisht [ 10/Feb/23 ] |
|
Hi valentin.garaschuk@gmail.com , just checking in - did the mongoc-interrupt-private.h suggestion fixed the issue for you? |
| Comment by Valentin Garaschuk [ 20/Dec/22 ] |
I was referring to the external tests that use the driver.
I will check that. Thank you. |
| Comment by Kevin Albertson [ 20/Dec/22 ] |
|
Hello valentin.garaschuk@gmail.com, thank you for the report. The 500ms delay on destroy is expected. Checks in between socket polls are 500ms. IIRC this caveat was considered when adding polling, but not considered a blocker. mongoc_client_pool_t is expected to live for the duration of an application, so the delay on mongoc_client_pool_destroy is expected to occur only once at application shutdown.
Does this refer to tests in the C driver? Or external tests written that use the C driver? Opening this ticket for future consideration. Adding a test-only mechanism may speed up C driver tests. Also consider: there is an unused mongoc-interrupt-private.h that may solve this. It may provide a way to interrupt the call to mongoc_stream_poll. |