Re: [OpenSIPS-Devel] [opensips] abandoned turn causes processes to sleep forever when handling retransmitted publishes (#754)

2016-01-14 Thread Will Mitchell
Here's a preliminary patch we put together:

https://gist.github.com/wakamoleguy/dc9d694e64364ba6f7d2

We haven't tested it yet, or even really compiled it.  The general idea is that 
if a process detects that it is about to throw away an old presentity, it still 
waits its turn and calls next_turn_phtable on the old one before moving on.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/754#issuecomment-171682508___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] abandoned turn causes processes to sleep forever when handling retransmitted publishes (#754)

2016-01-14 Thread Bogdan Andrei IANCU
Thank you for investigating this - now that is clear what is happens, I will 
work on a way to fix it. 

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/754#issuecomment-171680732___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] abandoned turn causes processes to sleep forever when handling retransmitted publishes (#754)

2016-01-14 Thread Will Mitchell
I could make the patch into an actual pull request, if you'd prefer, although 
for several reasons (including vulgarity of comments, sorry!) it would be more 
for discussion than an actual pull.  Let me know what you'd prefer.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/754#issuecomment-171683517___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] abandoned turn causes processes to sleep forever when handling retransmitted publishes (#754)

2016-01-13 Thread Eric Tamme
This exists on latest master 055f4b1 

Scenario:  2 PUBLISHES with the same E-Tag enter 
https://github.com/OpenSIPS/opensips/blob/master/modules/presence/presentity.c#L546
 as a result of a retransmission.

The first publish finds the presentity, increments last turn to say 5 for the 
sake of argument, then it enters the while loop, finds the presentity and 
continues processing updating it with a new e-tag and saving it the db releases 
locks and finishes.

The second publish enters because its turn matches 5, it finds the presentity 
and increments last turn to 6, it then enters the while loop, but it fails to 
find the presentity because the E-Tag has been changed by the previous publish. 
 It continues processing, but it never increments turn before exiting.  

This causes turn to stay at 6, which will cause the process to lockup forever, 
waiting for its turn, on the next publish received.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/754___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] abandoned turn causes processes to sleep forever when handling retransmitted publishes (#754)

2016-01-13 Thread Will Mitchell
>  It continues processing, but it never calls next_turn_phtable before 
> exiting. 

It technically *does* call next_turn_phtable, but on a *new* presentity in the 
phtable.  It does not increment the current_turn on the same presentity that it 
updated last_turn on.  This causes a mismatch on that presentity going forward.

> This will cause the process to lockup forever, waiting for its turn, on the 
> next publish received.

Specifically, both of the processes in this scenario will continue on their 
way.  The *next* publish to the original presentity will lock, because 
current_turn is less than last_turn, and nothing exists to increment it.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/754#issuecomment-171401097___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel