[asterisk-bugs] [JIRA] (ASTERISK-30341) cdr_adaptive_odbc: fails to write CDRs after database reload

Asterisk Team (JIRA) noreply at issues.asterisk.org
Wed Dec 21 12:01:51 CST 2022


    [ https://issues.asterisk.org/jira/browse/ASTERISK-30341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=260992#comment-260992 ] 

Asterisk Team commented on ASTERISK-30341:
------------------------------------------

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

> cdr_adaptive_odbc: fails to write CDRs after database reload
> ------------------------------------------------------------
>
>                 Key: ASTERISK-30341
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30341
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: CDR/cdr_adaptive_odbc
>    Affects Versions: 18.15.1
>         Environment: Asterisk 18.15.1 on Unbuntu 18.04.1
> MySQL 8.0.31-0ubuntu0.20.04.2 on Ubuntu 20.04.2
> Both servers on same physical network and subnet.
>            Reporter: Gregory Massel
>            Assignee: Gregory Massel
>            Severity: Major
>
> CDRs log perfectly to MySQL using cdr_adaptive_odbc up until the database shuts down and restarts.
> Occasionally Ubuntu will release an update version package for MySQL. When it does so, the database server automatically downloads the update, stops MySQL, installs the update and then restarts MySQL. When this happens, cdr_adaptive_odbc loses connection to the MySQL server and fails to ever reconnect.
> Asterisk logs countless messages like the following:
> [Dec  7 00:00:04] WARNING[28054] cdr_adaptive_odbc.c: SQL Prepare failed![INSERT INTO cdr_vpbx5 (start, clid, src, dst, dnid, dcontext, channel, dstchannel, lastapp, lastdata, duration, billsec, disposition, amaflags, accountcode, uniqueid, peeraccount, linkedid, sequence) VALUES ({ ts '2022-12-06 23:59:45' }, '"Control" <0123456789>', '0123456789', '0123456789', '0123456789', 'swvpbx-internal', 'PJSIP/xxx202-0007b59d', 'PJSIP/yyy-0007b59e', 'Dial', 'PJSIP/yyy/sip:0123456789 at 10.1.2.3:5060,120,', 18, 0, 'NO ANSWER', 3, 'xxx', '1670363985.509608', 'xxx', '1670363985.509608', 717979)]
> [Dec  7 00:00:04] WARNING[28054] cdr_adaptive_odbc.c: SQL Execute returned an error -1: HY000: [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.31-0ubuntu0.20.04.1] (59)
> I do NOT believe that the issue lies with the ODBC configuration, because func_odbc continues to work perfectly.
> my res_odbc.conf file looks like:
> ;;; odbc setup file
> [asterisk-cdr-connector]
> enabled => yes
> dsn => asterisk-cdr-connector
> username => asterisk
> password => redacted
> pre-connect => yes
> sanitysql => select 1
> ;idlecheck => 180
> ;share_connections => yes
> ;limit => 20
> max_connections => 20
> [clientzone-connector]
> enabled => yes
> dsn => clientzone-connector
> username => redacted
> password => redacted
> pre-connect => yes
> sanitysql => select 1
> isolation => repeatable_read
> ;idlecheck => 180
> ;share_connections => yes
> ;limit => 20
> max_connections => 20
> My cdr_adaptive_odbc.conf file looks like:
> [db]
> connection=asterisk-cdr-connector
> table=cdr
> Restarting Asterisk solves the issue. Issuing a "module reload res_odbc.so" and "module reload cdr_adaptive_odbc.so" also solves the issue.
> It is not just updates to MySQL that will cause this. Anything that causes the database to temporarily become inaccessible, e.g. a brief connectivity glitch, will also cause it.
> This also does not affect all Asterisk servers connected to the database; it would appear that it only affects those that make/receive a call and therefore attempt to write a CDR during the time that the database is briefly inaccessible.
> The correct functionality should be to attempt reconnection ~60 seconds later and then write the CDR, not to get caught in a frozen state.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list