Tags:
archive_me1Add my vote for this tag create new tag
, view all tags

Bug: Statistics script generates "Use of uninitialized value in hash element" messages.

perl 5.8:

[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 277, <GEN0> line 1879.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 277, <GEN0> line 1879.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 277, <GEN0> line 1918.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 277, <GEN0> line 1918.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 292, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 295, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 295, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 295, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 295, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in delete at /usr/local/www/twiki/bin/statistics line 296, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in string ne at /usr/local/www/twiki/bin/statistics line 299, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 301, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 301, <GEN0> line 1921.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 277, <GEN0> line 1922.
[Mon Aug 12 13:35:00 2002] statistics: Use of uninitialized value in hash element at /usr/local/www/twiki/bin/statistics line 277, <GEN0> line 1922.

perl 5.005_03:

[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 277, <GEN0> chunk 1879.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 277, <GEN0> chunk 1879.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 277, <GEN0> chunk 1918.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 277, <GEN0> chunk 1918.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 292, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 295, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 295, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 295, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 295, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 296, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 299, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 301, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 301, <GEN0> chunk 1921.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 277, <GEN0> chunk 1922.
[Mon Aug 12 13:41:18 2002] statistics: Use of uninitialized value at /usr/local/www/twiki/bin/statistics line 277, <GEN0> chunk 1922.

Test case

Environment

TWiki version: 03 Aug 2002
TWiki plugins:  
Server OS: FreeBSD 4.6-STABLE
Web server: Apache/1.3.26 (Unix) mod_perl/1.27 mod_ssl/2.8.10 OpenSSL/0.9.6a
Perl version:  
Client OS: XP/Home
Web Browser: IE 6.0

Testenv: http://dammaged.daemon.sh/twiki/bin/testenv

-- DrewCard - 12 Aug 2002

Follow up

This was reported in Support.BetaStatisticsErrorMessages.

Error could be caused by corrupt lines in the log files. TWiki currently does not guard against concurrent updates of the log files, so occational corrupt lines are possible.

Quick fix: Make statistics more robust by ignoring corrupt lines.

Correct fix: Prevent concurrent update of the log file.

-- PeterThoeny - 13 Aug 2002

Drew, thanks for the testenv link - I notice you are running under mod_perl, is this true for the statistics script as well? If so, do you get the same messages when running under CGI Perl and from the command line?

A patch to ignore corrupt lines would be welcome as I am very busy at work at the moment...

-- RichardDonkin - 13 Aug 2002

Since a another statistics incident statistics is not operating under mod_perl. I just ran statistics from the commandline, results similer to above. Output from that run can be found here.

Okay - I have just done some trial and error testing with my current month's stats file. Plus figureing out that the final part of the error message refers to an actual line in the statistics file (doh).

The offending lines are:

Line:   1879 | 10 Aug 2002 - 19:03 | Main.TWikiGuest | view | Test.BETA_defaultWebHome |  (not exist) | 192.168.10.105 |
Line:   1918 | 10 Aug 2002 - 19:30 | Main.TWikiGuest | view | Main.BETA_defaultWebHome |  | 192.168.10.100 |
Line:   1921 | 10 Aug 2002 - 19:32 | Main.DrewCard | rename | Main.BETA_defaultWebHome | moved to Trash.BETA_defaultWebHome  | 192.168.10.100 |
Line:   1922 | 10 Aug 2002 - 19:32 | Main.TWikiGuest | view | Trash.BETA_defaultWebHome |  | 192.168.10.100 |

Other lines of interest (excludeing the above) :

   1878 | 10 Aug 2002 - 19:03 | Main.DrewCard | edit | Test.BETA_defaultWebHome | (not exist) | 192.168.10.105 |
   1914 | 10 Aug 2002 - 19:30 | Main.DrewCard | edit | Main.BETA_defaultWebHome | (not exist) | 192.168.10.100 |
   1917 | 10 Aug 2002 - 19:30 | Main.DrewCard | save | Main.BETA_defaultWebHome |  | 192.168.10.100 |
   1920 | 10 Aug 2002 - 19:32 | Main.DrewCard | save | Main.BETA_defaultWebHome | repRev 1.1 Main.DrewCard 2002/08/10 23:32:00 | 192.168.10.100 |

Or for the file itself, http://dammaged.daemon.sh/~twiki/log200208.txt.BAD.

I don't recall all the steps performed that acheved the above lines, but I did have a web named BETA_default for around an hour or so, so I think there is more going on here than a statistics fault.

-- DrewCard - 13 Aug 2002

Just got this same error myself. From looking at the code, it has to be the $topicName that's the problem. $webName is used at line 273 without errors. One of the problem lines looks like:

| 14 Aug 2002 - 20:32 | Main.JohnRouillard | view | Lab.stickskin=default |  (not exist) | 137.237.12.48 |
I probably typed in a bogus URL to get this, but I am not sure.

But look at the regexp used to parse the line:

$line =~ /^\|[^\|]*\| ([a-z0-9]+\.[a-z0-9]+) \| ([a-z0-9]+) \| ([a-z0-9]+)\.([a-z0-9]+) /io;
          ^^^^^^^^^^ skip field 1, parse date
                     ^^^^^^^^^^^^^^^^^^^^^^^^^ field 2 parse user name put into $1
                                               ^^^^^^^^^^^^^^^ field 3 parse command put into $2
                  field 4  parse topic name saving web in $3  ^^^^^^^^^^^^^
                  field 4 parse topic name assigning $4 to topic name       ^^^^^^^^^^^^  *PROBLEM*

The regexp used to parse the topic name says that it must match all alphanumerics followed by a space. In my example = is not an alphanumeric and therefore the pattern fails. In Drew's example _ is not matched and the match fails to set $4. Possible fix, although I am not sure of the implications, change the fourth element to read:

 ([^|]*) |
and may God help anybody who puts a | into their TWiki topic 8-). Also, I have TWiki pages with _ in them as Drew has that are causing statistics to fill the log.

-- JohnRouillard - 15 Aug 2002

Fix record

Now fixed in CVS, try the latest version at CVS:bin/statistics. Tested on the weird logfile lines provided above. Note that the real problem here is that the webname is invalid, causing the regex to fail - however, invalid topics, users and webnames should now all be caught by the statistics script.

-- RichardDonkin - 15 Aug 2002

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2002-08-16 - RichardDonkin
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.