[Home]

Summary:ASTERISK-13150: [patch] Column count doesn't match value count
Reporter:George Qualley IV (qualleyiv)Labels:
Date Opened:2008-12-01 09:30:09.000-0600Date Closed:2009-01-08 15:58:11.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Addons/cdr_mysql
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20081211__bug14002.diff.txt
( 1) 20081214__bug14002.diff.txt
( 2) 20081219__bug14002.diff.txt
Description:Things will be working just fine and then I'll sporadically receive:

[Dec  1 09:17:11] ERROR[139] cdr_addon_mysql.c: Failed to insert into database: (1136) Column count doesn't match value count at row 1

I'm wondering if it might be/be related to this bug: http://bugs.digium.com/view.php?id=13815
Comments:By: Tilghman Lesher (tilghman) 2008-12-02 11:09:58.000-0600

Probably not, but since we just released addons-1.6.1-rc2, I'd invite you to try that version.

By: George Qualley IV (qualleyiv) 2008-12-02 11:45:59.000-0600

I've installed addons-1.6.1-rc2 and I'll report any findings with this version.

By: George Qualley IV (qualleyiv) 2008-12-08 15:27:27.000-0600

I'm still receiving the error despite the latest install:

[Dec  8 15:18:06] ERROR[152] cdr_addon_mysql.c: Failed to insert into database: (1136) Column count doesn't match value count at row 1

Like I said before, it's sporadic. I've checked my database schema several times and I'm quite sure that it's correct unless there have been some undocumented (at least as far as I can find) changes. I've used the same schema for quite some time under 1.4 with no problems.

By: Sean Bright (seanbright) 2008-12-10 22:20:42.000-0600

Could you attach the schema of your CDR table?  Just to make sure we're all looking at the same thing.

By: George Qualley IV (qualleyiv) 2008-12-10 22:35:46.000-0600

Here you are, please ask if you need anything else:

-- phpMyAdmin SQL Dump
-- version 3.0.0-beta
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 10, 2008 at 10:35 PM
-- Server version: 5.0.67
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `asterisk`
--

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

--
-- Table structure for table `cdr`
--

CREATE TABLE `cdr` (
 `calldate` datetime NOT NULL default '0000-00-00 00:00:00',
 `clid` varchar(80) NOT NULL default '',
 `src` varchar(80) NOT NULL default '',
 `dst` varchar(80) NOT NULL default '',
 `dcontext` varchar(80) NOT NULL default '',
 `channel` varchar(80) NOT NULL default '',
 `dstchannel` varchar(80) NOT NULL default '',
 `lastapp` varchar(80) NOT NULL default '',
 `lastdata` varchar(80) NOT NULL default '',
 `duration` int(11) NOT NULL default '0',
 `billsec` int(11) NOT NULL default '0',
 `disposition` varchar(45) NOT NULL default '',
 `amaflags` int(11) NOT NULL default '0',
 `accountcode` varchar(20) NOT NULL default '',
 `userfield` varchar(255) NOT NULL default '',
 `uniqueid` varchar(32) NOT NULL,
 KEY `calldate` (`calldate`),
 KEY `dst` (`dst`),
 KEY `accountcode` (`accountcode`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

By: Tilghman Lesher (tilghman) 2008-12-11 00:28:16.000-0600

Please apply this patch.  This should tell us what the SQL is that is failing, when it fails.

By: George Qualley IV (qualleyiv) 2008-12-11 13:18:14.000-0600

I've applied the patch. I will report back as soon as I have some details that may be helpful.

By: Sean Bright (seanbright) 2008-12-11 15:08:26.000-0600

Attach your cdr_mysql.conf too when you get bored.  Mask out the relevant passwords.

By: George Qualley IV (qualleyiv) 2008-12-14 21:19:42.000-0600

Ok, here's a failure log:

[Dec 13 18:06:58] VERBOSE[148] pbx.c:   == Spawn extension (smitten, 14027309248, 3) exited non-zero on 'Local/14027309248@smitten-1b6a;2'
[Dec 13 18:06:58] ERROR[148] cdr_addon_mysql.c: Failed to insert into database: (1136) Column count doesn't match value count at row 1
[Dec 13 18:06:58] NOTICE[148] cdr_addon_mysql.c: Failing SQL: INSERT INTO cdr () VALUES ('')

Here's the cdr_mysql.conf:

[global]
hostname=localhost
dbname=asterisk
table=cdr
;password=
user=asterisk
;port=3306
sock=/var/mysql/mysql.sock


Note that I've got the mysql asterisk user setup so it does not require a password.

By: Tilghman Lesher (tilghman) 2008-12-14 23:49:41.000-0600

It appears this may happen specifically during a reload of the module.  If that's the case, then this patch should fix the problem.

By: George Qualley IV (qualleyiv) 2008-12-16 23:08:39.000-0600

Tried applying the patch and got this:

mail:asterisk-addons-1.6.1-rc2 root# wget 'http://bugs.digium.com/file_download.php?file_id=20986&type=bug' -O - | patch -p0
--23:04:55--  http://bugs.digium.com/file_download.php?file_id=20986&type=bug
          => `-'
Resolving bugs.digium.com... 76.164.171.226
Connecting to bugs.digium.com|76.164.171.226|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,628 (1.6K) [text/plain]

100%[====================================>] 1,628         --.--K/s            

23:04:56 (2.19 MB/s) - `-' saved [1628/1628]

patching file cdr/cdr_addon_mysql.c
Hunk #1 succeeded at 333 (offset -7 lines).
Hunk #2 succeeded at 353 (offset -7 lines).
Hunk #3 succeeded at 430 (offset -7 lines).
Hunk #4 FAILED at 469.
Hunk ASTERISK-1 succeeded at 599 (offset -41 lines).
1 out of 5 hunks FAILED -- saving rejects to file cdr/cdr_addon_mysql.c.rej

By: Sean Bright (seanbright) 2008-12-19 20:24:29.000-0600

Try the most recent patch.  It's identical to Corydon's last patch except it should apply cleanly to addons-1.6.1-rc2 (just make sure that you roll back your current cdr/cdr_addon_mysql.c before trying to apply it).

By: George Qualley IV (qualleyiv) 2008-12-21 15:15:47.000-0600

Sorry, but I probably won't have an opportunity to test the patch. I've switched to ODBC for realtime and CDR. I was having issues with both of the aforementioned setups when using the mysql modules and my understanding is that the ODBC modules are a bit more robust. I've spent quite a lot of time lately screwing with things and I think I need to move on to other tasks. Hopefully the issue will be fixed for others though...

By: Tilghman Lesher (tilghman) 2008-12-21 19:00:32.000-0600

As far as robustness, the cdr_adaptive_odbc is more robust than cdr_odbc, and cdr_adaptive_odbc will probably replace cdr_odbc in the future.

By: George Qualley IV (qualleyiv) 2008-12-22 09:19:21.000-0600

Actually, I should have said cdr_adaptive_odbc instead of cdr_odbc...

By: Digium Subversion (svnbot) 2009-01-08 15:58:10.000-0600

Repository: asterisk-addons
Revision: 720

_U  branches/1.6.0/
U   branches/1.6.0/cdr/cdr_addon_mysql.c

------------------------------------------------------------------------
r720 | tilghman | 2009-01-08 15:58:10 -0600 (Thu, 08 Jan 2009) | 10 lines

Merged revisions 719 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/trunk

........
 r719 | tilghman | 2009-01-08 15:55:12 -0600 (Thu, 08 Jan 2009) | 2 lines
 
 Prevent a possible race between a reload event and logging a CDR
Closes issue ASTERISK-13150
........

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

http://svn.digium.com/view/asterisk-addons?view=rev&revision=720