[Serusers] Re: Strange error on registration

Jan Janak jan at iptel.org
Sun Apr 4 21:24:22 CEST 2004


On 04-04 20:13, Alex Bligh wrote:
> Jan,
> 
> >No, it does not show the entry because it is expired. What is the value
> >of flags field of that line ?
> 
> flags is set to 0 (like the other entries).

   OK.

> 
> >Situation like this can happen when there are some problems connecting
> >the database, I would suggest you to wipe the line out. Let me know if
> >it happens again.
> 
> ... and ...
> 
> --On 04 April 2004 20:47 +0200 Klaus Darilion 
> <klaus.mailinglists at pernau.at> wrote:
> 
> >ser does only delete expired contact if they are in the ram, furthermore
> >the new entry can't be inserted into the location table, as
> >(username,contact,domain) are a key, so the db insert fails.
> >
> >I see 2 reasons:
> >- ser doesn't the location database at startup
> >- ser does delete the expired contact from RAM, but not from the db
> 
> Indeed - it seems ser has got into a state where the state has been
> wiped in RAM, but not in the database.
> 
> I realise I can fix the symptom just by deleting the appropriate
> line. However, this won't fix the underlying problem, which I
> think is
> a) ser shouldn't get into this state (probably inevitable if ser
>   crashes, and I think it could have got into this state from
>   me deliberately testing failover by being nasty to the boxes)

  No, it should not get into this state. All expired entries should be
  deleted in the next timer run once they are loaded into the memory. To
  find out why it does not happen in this case, enable debugging,
  restart the server and let it run (until the cleanup timer hits). It
  should print some error messages.

> b) ser does not recover gracefully from this state (requires manual
>   intervention). I /think/ what is happening here (and I haven't
>   done a full code inspection) is ser tries to write into the
>   database, it fails because a line with the same (username,
>   domain, contact) 3-tuple is already there, but then it can
>   as that entry is already expired, it never seems to get purged,
>   and ser gets stuck.

  No, this should not happen. When you restart the server it loads all
  the contacts from the database into memory. If an update comes
  (REGISTER message) it will update the entry in the memory and then it
  tries to update the entry in the database. The entry in the memory is
  valid even if the database update fails. That way ser can work even if
  database connection is broken.

  The only situation I can imagine this could happen is when database
  delete fails. The entry is removed from the cache but it is still
  present in the database. In such a situation subsequent inserts and
  updates will fail. But ser should recover after restart because it
  will reload all entries.

  Check if there is any error message during re-loading at startup or
  during the cleanup timer.

> I wonder if the solution is that if a database write fails, see if
> an entry with the same 3-tuple is already there, if it is, check
> (manually on expiry date) to see if it has expired, and if so,
> delete it, and reinsert the original entry.
> 
> I'm sort of perplexed as to why this particular long-expired entry
> hasn't just got deleted through expiry.

  Again, enable debugging and check the logs.

    Jan.




More information about the sr-users mailing list