Skip Menu |

This queue is for tickets about the DBD-CSV CPAN distribution.

Report information
The Basics
Id: 121127
Status: rejected
Priority: 0/
Queue: DBD-CSV

People
Owner: Nobody in particular
Requestors: NHORNE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bizarre copy of HASH in scalar assignment
I am seeing this error at line 566 of Text/CSV_XS.pm. Sorry but I don't have a small test dataset and program to reproduce it yet, but I'm giving you a heads up in case you can see what's going on. sub error_diag { my $self = shift; #<<<<<<<< This is line 566 my @diag = (0 + $last_new_err, $last_new_err, 0, 0, 0); if ($self && ref $self && # Not a class method or direct call $self->isa (__PACKAGE__) && exists $self->{_ERROR_DIAG}) {
Did you find a reproducible case yet?
On Wed Apr 26 02:18:24 2017, HMBRAND wrote: Show quoted text
> Did you find a reproducible case yet?
All of the simple cases work. Which is not surprising I guess, it's only the big cases where something is getting corrupted on the stack.
I'm sorry for the time it's taken, although not reproducible I have finally been able to get a stack trace together. It's failling when I do this SQL "SELECT * FROM events WHERE entry IS NOT NULL AND entry NOT LIKE '#%' AND band LIKE ? ORDER BY entry" and I'm giving the argument 'Canberra Brass' via DBD::CSV. I've opened the database with this: $dbh = DBI->connect("dbi:CSV:csv_sep_char=|"); Now I realize this could well be a bug in DBD::CSV, but at the moment I don't know how to progress. I'm attaching the database file, which isn't strict CSV which may be the problem, perhaps.
Subject: events.db
Download events.db
application/octet-stream 253.7k

Message body not shown because it is not plain text.

Maybe your perl, maybe any of the versions of the modules used ... I copied your events.db to rt121127.csv --8<--- rt121127.pl use 5.18.2; use warnings; use DBI; use Data::Peek; binmode STDERR, ":encoding(utf-8)"; my $dir = -d "sandbox" ? "sandbox" : "."; my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_ext => ".csv/r", f_dir => $dir, csv_null => 1, csv_sep_char => "|", csv_quote_char => undef, }); my $sth = $dbh->prepare (<<~ ";"); select * from rt121127 where entry IS NOT NULL and entry NOT LIKE '#%' and band LIKE ? order by entry ; $sth->execute ("Canberra Brass"); while (my $row = $sth->fetch) { DDumper $row; } -->8--- $ perl -d:TraceUse=hidecore sandbox/rt121127.pl [ '1097', 'Canberra Brass', '9th Annual Hall Concert', 'Australia', 'Brass Band', 'Hall School Museum and Heritage Centre, Australia capital territory', undef, '16', '30', 'https://www.facebook.com/events/1925594404364691', undef, 'njh@bandsman.co.uk', '19-Mar-2017', 'njh' ] Modules used from sandbox/rt121127.pl: 2. DBI 1.637, sandbox/rt121127.pl line 6 [main] 15. Config_heavy.pl, Config.pm line 80 16. Config_git.pl, Config_heavy.pl line 1414 [Config] 53. DBD::CSV 0.50, DBI.pm line 787 (eval 15) [DBI::_firesafe] 54. Text::CSV_XS 1.32, DBD/CSV.pm line 43 [DBD::CSV::dr] 55. DBD::File 0.44, DBD/CSV.pm line 15 [DBI::_firesafe] 57. DBI::DBD::SqlEngine 0.06, base.pm line 100 58. DBI::SQL::Nano 1.015544, DBI/DBD/SqlEngine.pm line 27 [base] 59. SQL::Statement 1.412, DBI/SQL/Nano.pm line 34 60. SQL::Parser 1.412, SQL/Statement.pm line 20 61. Params::Util 1.07, SQL/Parser.pm line 21 65. utf8_heavy.pl, utf8.pm line 16 67. unicore/Heavy.pl, utf8_heavy.pl line 185 [utf8] 68. unicore/lib/Perl/Word.pl, utf8_heavy.pl line 534 [utf8] 89. SQL::Dialects::AnyData 1.412, SQL/Parser.pm line 319 90. SQL::Dialects::Role 1.412, SQL/Dialects/AnyData.pm line 20 69. SQL::Eval 1.412, SQL/Statement.pm line 21 70. SQL::Statement::RAM 1.412, SQL/Statement.pm line 22 71. SQL::Statement::TermFactory 1.412, SQL/Statement.pm line 23 72. SQL::Statement::Term 1.412, SQL/Statement/TermFactory.pm line 16 73. SQL::Statement::Operation 1.412, SQL/Statement/TermFactory.pm line 17 74. SQL::Statement::Placeholder 1.412, SQL/Statement/TermFactory.pm line 18 75. SQL::Statement::Function 1.412, SQL/Statement/TermFactory.pm line 19 76. SQL::Statement::Functions 1.412, SQL/Statement/Function.pm line 68 [SQL::Statement::Function::UserFunc] 80. Module::Runtime 0.015, SQL/Statement/Functions.pm line 26 81. SQL::Statement::Util 1.412, SQL/Statement.pm line 24 82. Clone 0.39, SQL/Statement.pm line 27 14. Data::Peek 0.47, sandbox/rt121127.pl line 7 [main] 17. Perl::Tidy 20170521, Data/Peek.pm line 24 (eval 5) 24. Log::Agent, Storable.pm line 32 (FAILED) 30. Encode::ConfigLocal, Encode.pm line 69 (FAILED) 48. HTML::Entities 3.69, Perl/Tidy.pm line 4613 (eval 13) [Perl::Tidy::HtmlWriter] 49. HTML::Parser 3.72, HTML/Entities.pm line 152 So, on my system with those modules, the error does not reproduce.
I moved this ticket to the DBD-CSV queue and put the status on "stalled" As I am unable to reproduce any failure with the combination of data en script supplied, I will close this as resolved in a month or so if no additional information is supplied, assuming updates of the modules in use will resolve your issue.
In doubt, Nigel could provide the most relevant versions using use DDP; my $csv_version_info = $dbh->csv_versions (); p ($csv_version_info);
You are correct, it's not reproducible - sometimes I get the error, rerun the command and the error doesn't appear. As it says, it's bizarre.
On Thu Sep 21 08:33:38 2017, NHORNE wrote: Show quoted text
> You are correct, it's not reproducible - sometimes I get the error, > rerun the command and the error doesn't appear. As it says, it's > bizarre.
Could it have something to do with hash randomization? Try running your script with $ PERL_PERTURB_KEYS=2 PERL_HASH_SEED_DEBUG=1 perl ..... You will see your script begin with output like: HASH_FUNCTION = ONE_AT_A_TIME_HARD HASH_SEED = 0x0d4469e43515b0b7 PERTURB_KEYS = 2 (DETERMINISTIC) When the script fails, then copy the HASH_SEED value (0x0d4469e43515b0b7 in this example), and see if you can reproduce the failure like this: $ PERL_HASH_SEED=0x0d4469e43515b0b7 perl .....
Show quoted text
> Could it have something to do with hash randomization? Try running > your script with > > $ PERL_PERTURB_KEYS=2 PERL_HASH_SEED_DEBUG=1 perl .....
I tried this en ran it about 40 times without a crash Thanks for participating. New ideas are always welcome.
I've been able to get a stack trace, which should help. 2017/11/30 05:23:41 FATAL> 113899: WarnDie.pm:273 Log::WarnDie::__ANON__ - panic: attempt to copy freed scalar 6a1ae28 to 61d4608 at /home/hornenj/perlmods/lib/perl/5.14.2/Text/CSV_XS.pm line 609, <GEN22> line 1192. Log::WarnDie::__ANON__("panic: attempt to copy freed scalar 6a1ae28 to 61d4608 at /ho"...) called at /home/hornenj/perlmods/lib/perl/5.14.2/Text/CSV_XS.pm line 609, Text::CSV_XS::error_diag(undef) called at /home/hornenj/perlmods/share/perl/5.14.2/DBD/CSV.pm line 356, eval {...} called at /home/hornenj/perlmods/share/perl/5.14.2/DBD/CSV.pm line 356, DBD::CSV::Table::fetch_row(DBD::CSV::Table=HASH(0x426e2d8), DBI::st=HASH(0x6a44dd8)) called at /home/hornenj/perlmods/share/perl/5.14.2/SQL/Statement.pm line 1064, SQL::Statement::SELECT(DBD::CSV::Statement=HASH(0x4577340), DBI::st=HASH(0x6a44dd8), ARRAY(0x5f584c0)) called at /home/hornenj/perlmods/share/perl/5.14.2/SQL/Statement.pm line 157, SQL::Statement::execute(DBD::CSV::Statement=HASH(0x4577340), DBI::st=HASH(0x6a44dd8), ARRAY(0x5f584c0)) called at /home/hornenj/perlmods/lib/perl/5.14.2/DBI/DBD/SqlEngine.pm line 1271, eval {...} called at /home/hornenj/perlmods/lib/perl/5.14.2/DBI/DBD/SqlEngine.pm line 1269, DBI::DBD::SqlEngine::st: :execute(DBI::st=HASH(0x6a44dd8), "Knighton Town Silver Band") called at /home/hornenj/lib/perl5/BBPortal/DB.pm line 215, BBPortal::DB::selectall_hashref(BBPortal::DB::events=HASH(0x2a65288), HASH(0x6cbe328)) called at /home/hornenj/lib/perl5/BBPortal/Display/by_location.pm line 152, BBPortal::Display::by_location::html(BBPortal::Display::by_location=HASH(0x4577100), HASH(0x474be48)) called at /home/hornenj/lib/perl5/BBPortal/Display.pm line 286, BBPortal::Display::as_string(BBPortal::Display::by_location=HASH(0x4577100), HASH(0x474be48)) called at page.fcgi line 406, main::doit() called at page.fcgi line 168, main::__ANON__() called at /home/hornenj/perlmods/lib/perl5/Error.pm line 421, eval {...} called at /home/hornenj/perlmods/lib/perl5/Error.pm line 413, Error::subs::try(CODE(0x2a99f98), HASH(0x42e9ce0)) called at page.fcgi line 219
I'm going to turn off auto_diag and see if that helps to resolve the problem, or at least helps me to find the data that's causing the crash.