Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 913235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:31:22+00:00 2026-05-15T17:31:22+00:00

I am writing a program to extract data from a bunch of text files

  • 0

I am writing a program to extract data from a bunch of text files and stuff it into DB. All of my commands currently have the form similar to this (with different queries):

$query = "INSERT INTO relations (relation_type_id, confidence) VALUES ($reltypeid, $conf)";
print "$query\n";
$result = $conn->query($query);
$relid = $result->insertid();
...

However, I have noticed random errors pop up during the execution, like this:

INSERT INTO relations (relatiDBD::mysql::st execute failed: Query was empty at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Mysql.pm line 175.
DBD::mysql::st execute failed: Query was empty at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Mysql.pm line 175.
on_type_id, confidence) VALUES (12, 0.709310711263845)

If I run it with perl -w, I get this:

INSERT INTO relations (relatiUse of uninitialized value in subroutine entry at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/DBD/mysql.pm line 211.
Use of uninitialized value in subroutine entry at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Mysql.pm line 175.
DBD::mysql::st execute failed: Query was empty at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Mysql.pm line 175.
Use of uninitialized value in subroutine entry at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/DBD/mysql.pm line 211.
Use of uninitialized value in subroutine entry at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Mysql.pm line 175.
DBD::mysql::st execute failed: Query was empty at /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/Mysql.pm line 175.
on_type_id, confidence) VALUES (12, 0.709310711263845)

Now what worries me is that clearly some multithreading crap is going on – the program does not die, and the error is inserted in the middle of a print – and I have no clue how to debug it. For the record, I myself am not forking or threading anywhere except backticking zcat, and these are all the packages that are included:

use Switch;
use File::Basename;

and in an included pm:

use Mysql;
use Exporter qw(import);

Also, I’ve googled the error message, and I can’t get the full hit (name & location). Just the error name (“Query was empty”) hit an article where the poster was accessing a connection from two subsequently forked processes.

One more thing of note: the phenomenon is deterministic. The errors always appear in the same place, as long as the code is intact. If I change the output (for instance, insert some marker lines like print "---"; to separate my record blocks), the errors occur earlier (can’t really say if it’s on the same byte-count of output or not).

Is there a way to disable multithreading in perl? How do I catch the bugger? What is that error message about?

UPDATE: The problem was the combination of stdout buffering, misleading Google hit, perl directory name and a major case of brain fart.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:31:23+00:00Added an answer on May 15, 2026 at 5:31 pm

    Please post the whole Perl program.

    Nothing I see here makes me think that this is a multithreading issue. Unless you’re asking for threads somewhere, you aren’t getting multiple threads in Perl5.

    As a wild guess, due to the extra print statements changing the results it feels like a buffering issue. Try hotting your STDOUT with $|=1;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Java program where I have to extract some data from a
I'm about to start writing a program which will attempt to extract data from
I'm writing a Python program to extract data from the middle of a 6
Im currently writing a c++ program that needs to extract string and numeric data
I am writing a program that downloads tar.xz files from a server and extracts
I'm writing this small program to extract any number of email address from a
I'm writing a program (in Java) that needs to extract links from webpages. I'm
I want to extract information from two columns of textfile. Currently I have my
Im writing a program that should read input via stdin, so I have the
I'm writing a program that handles DBs and writes any changes into ListView for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.