[Home]

Summary:ASTERISK-16067: [patch] module reload cdr_odbc.so produces an error about not being able to register ODBC method with CDR.
Reporter:John Nemeth (jnemeth)Labels:
Date Opened:2010-05-06 22:34:38Date Closed:2010-07-25 13:22:12
Priority:MinorRegression?No
Status:Closed/CompleteComponents:CDR/cdr_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20100507__issue17304.diff.txt
Description:If you edit cdr_odbc.conf and do 'module reload cdr_odbc.so' you'll get an error complaining about not being able to register the ODBC method with the CDR subsystem.  This is because it is already registered.  Doing a module unload followed by a module load will work around the issue.  I have used the viewvc tool to check the latest version of cdr_ocbc.c and the issue is still there.
Comments:By: Leif Madsen (lmadsen) 2010-05-07 11:36:28

Do you happen to have a patch you could provide, or at least point out in the code where the issue exists? (at least it seems like you've narrowed down the area of the problem)

By: John Nemeth (jnemeth) 2010-05-07 15:50:16

There was a "Reviewboard Link" with the initial submission that pointed at a patch.  Looks like tilghman killed the link, but it is in the "Issue History" section.  Anyways, the patch was pretty simple.  Near the bottom of cdr/cdr_odbc.c:odbc_load_module() is code that does:

res = ast_cdr_register(...
if (res) {
       ast_log(...
}

Just wrap those lines with
if (!reload) {
...
}



By: Tilghman Lesher (tilghman) 2010-05-07 16:26:50

Patches have to be submitted with a license or on our reviewboard, not on an external site.

By: Tilghman Lesher (tilghman) 2010-05-07 16:50:35

Anyway, I believe the better way to solve this is to track the current state of the registration, and conditionally register or unregister, based upon the state.

By: John Nemeth (jnemeth) 2010-06-19 19:52:26

I tested your patch and it appears to be working fine.

By: Digium Subversion (svnbot) 2010-07-25 13:21:26

Repository: asterisk
Revision: 279410

U   branches/1.8/cdr/cdr_odbc.c

------------------------------------------------------------------------
r279410 | tilghman | 2010-07-25 13:21:25 -0500 (Sun, 25 Jul 2010) | 8 lines

Don't re-register CDR module on reload.

(closes issue ASTERISK-16067)
Reported by: jnemeth
Patches:
      20100507__issue17304.diff.txt uploaded by tilghman (license 14)
Tested by: jnemeth

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=279410

By: Digium Subversion (svnbot) 2010-07-25 13:22:12

Repository: asterisk
Revision: 279413

_U  trunk/
U   trunk/cdr/cdr_odbc.c

------------------------------------------------------------------------
r279413 | tilghman | 2010-07-25 13:22:11 -0500 (Sun, 25 Jul 2010) | 15 lines

Merged revisions 279410 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r279410 | tilghman | 2010-07-25 13:21:27 -0500 (Sun, 25 Jul 2010) | 8 lines
 
 Don't re-register CDR module on reload.
 
 (closes issue ASTERISK-16067)
  Reported by: jnemeth
  Patches:
        20100507__issue17304.diff.txt uploaded by tilghman (license 14)
  Tested by: jnemeth
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=279413