Skip to content

sip: request - fix parallel use of dnsrr#1525

Closed
cspiel1 wants to merge 1 commit intobaresip:mainfrom
cspiel1:sip_request_dnsrr_parallel_use
Closed

sip: request - fix parallel use of dnsrr#1525
cspiel1 wants to merge 1 commit intobaresip:mainfrom
cspiel1:sip_request_dnsrr_parallel_use

Conversation

@cspiel1
Copy link
Collaborator

@cspiel1 cspiel1 commented Feb 18, 2026

If multiple SIP requests are sent in parallel to the same host then
multiple references to the same dnsrr object will be used in different
request objects. But linking of one le to multiple lists is not possible.
Now for each dnsrr reference an le object is created.

Another solution with deep copy of dnsrr: #1512

@cspiel1
Copy link
Collaborator Author

cspiel1 commented Feb 18, 2026

The Windows test run failed with:

  test_rtp_listen                 : 
rtptest: TEST_ERR: /home/runner/work/re/re/baresip-win32/re/test/rtp.c:553: (Unknown error [10013])

rtptest: TEST_ERR: /home/runner/work/re/re/baresip-win32/re/test/rtp.c:612: (Unknown error [10013])
test:   test_rtp_listen         : NOK: Unknown error [10013]

retest: TEST_ERR: /home/runner/work/re/re/baresip-win32/re/test/main.c:247: (Unknown error [10013])

This is not related to this PR.

Edit: Maybe should be made more stable. E.g. Maybe like here #1526

@cspiel1 cspiel1 marked this pull request as draft February 18, 2026 10:48
@cspiel1
Copy link
Collaborator Author

cspiel1 commented Feb 18, 2026

Converted to draft. Let's first complete this #1520.

If multiple SIP requests are sent in parallel to the same host then
multiple references to the same dnsrr object will be used in different
`request` objects. But linking of one `le` to multiple lists is not possible.
Now for each `dnsrr` reference an `le` object is created.
@cspiel1 cspiel1 force-pushed the sip_request_dnsrr_parallel_use branch from 3b6081d to c33092d Compare February 19, 2026 10:42
@cspiel1
Copy link
Collaborator Author

cspiel1 commented Feb 19, 2026

It seems that this is the only location where elements are added to multiple lists (parallel SIP requests):

$ grep -r -E "list_.*mem_ref" src
src/sip/msg.c:		list_append(&msg->hdrl, &hdr->le, mem_ref(hdr));
src/sip/msg.c:			list_append(&msg->hdrl, &hdr->le, mem_ref(hdr));
src/sip/request.c:		list_append(lst, le, mem_ref(rr));

msg.c does at the end of the same function a mem_deref(hdr). Thus only in request.c the problem sits.

Thus blowing up the list API maybe is not worth to solve the issue mentioned first here: #1512.

I suggest this solution with alloc le. Disadvantage, we have to do the list flush, manually in the destructor.

@cspiel1 cspiel1 marked this pull request as ready for review February 19, 2026 10:51
@cspiel1 cspiel1 marked this pull request as draft February 19, 2026 10:54
@cspiel1 cspiel1 marked this pull request as ready for review February 19, 2026 11:03

list_flush(&req->cachel);
list_flush(&req->addrl);
list_flush(&req->srvl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

srvl must now also be flushed manually.

@cspiel1
Copy link
Collaborator Author

cspiel1 commented Feb 19, 2026

Will be replaced by an rr deep copy solution.

@cspiel1 cspiel1 closed this Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments