Piwik 1.3: archive.sh: line 73: 7761 Segmentation fault $CMD


#1

After Update archive.sh gives many of these errors.

archive.sh: line 73: 7761 Segmentation fault $CMD

How can I solve this problem?

Fabian


#2

There is a typo in the file “archive.sh”. In line 76 there is a space between “–” and “module” wich has to be removed. After that it worked for me. Sadly automatic archiving per request still fails.


#3

I tried your fix in this minute.

Result:
No errors, but NO function too…


#4

Worked for me. I also have to add that I had to change the database adapter because I do the archiving via web access wich led to a segmentation fault in the PDO adapter. See http://forum.piwik.org/read.php?2,75332 for details

Archiving period = day for idsite = 1…

Archiving period = week for idsite = 1…

Archiving period = month for idsite = 1…

Archiving period = year for idsite = 1…

Archiving for idsite = 1 done!
Reports archiving finished.

Starting Scheduled tasks…

No data available
Finished Scheduled tasks.


#5

[quote=Nocturne]
There is a typo in the file “archive.sh”. In line 76 there is a space between “–” and “module” wich has to be removed. After that it worked for me. Sadly automatic archiving per request still fails.[/quote]

Thanks! working my way through these speed bumps today. :slight_smile:


#6

[quote=“Dave Lozier”]

[quote=Nocturne]
There is a typo in the file “archive.sh”. In line 76 there is a space between “–” and “module” wich has to be removed. After that it worked for me. Sadly automatic archiving per request still fails.[/quote]

Thanks! working my way through these speed bumps today. :)[/quote]

This still didn’t seem to help or at least was not consistent. The Piwik_Common::assignCliParametersToRequest() method just parses the command line arguments into the super global $_GET with parse_str() so I simply removed “–” as it’s not needed. (or appears to not be)

I’m also running archive.sh as root for the time being while I figure out why www-data doesn’t have write permissions where it needs. For now cron based archiving is working for me.


(Matthieu Aubry) #7

archive.sh doesn’t have a typo or bug in it, as suggested by Nocturne, or at least it is working for hundreds of us, maybe a specific issue with your system?


#8

I can confirm.

After update PHP (5.3.x > 5.3.6-6, Debian 5) all is fine again! Thank you for help. :slight_smile:


#9

[quote=matt]
archive.sh doesn’t have a typo or bug in it, as suggested by Nocturne, or at least it is working for hundreds of us, maybe a specific issue with your system?[/quote]

I agree - I was just noting that the – dashes appear to not be needed. They’ll end up as $_GET[’–’] = ‘’.

I"m still getting some segfaults unfortunately. The server is Ubuntu 10.04 LTS - fully updated. It’s a dual dual core opteron box with 10 gigabytes of ram on raid 10 (10k drives).

I have cron set to run archive.sh 3 times an hour - if it segfaults the next run seems to work. One thing I noticed is that I have some archive tables in the database for January of this year but I didn’t install Piwik until this past Sunday. I see no January dates in the visit log table so am not sure where these dates are coming from.


(Matthieu Aubry) #10

January data in the table is expected, since january will store yearly reports.

Segfault is definitely a bug in PHP, so, maybe you haven’t upgraded all to latest version (including libs like PDO etc.) or maybe you found a new bug in a library!


(vipsoft) #11

If you’re using Ubuntu, please apt-get the new packages. There was apparently a regression (or two) in the Ubuntu builds that would cause a seg fault.

  • Ubuntu 11.04
  • Ubuntu 10.10
  • Ubuntu 10.04 LTS
  • Ubuntu 9.10
  • Ubuntu 8.04 LTS
  • Ubuntu 6.06 LTS

#12

The – tells php that any tokens that follow should not be taken as option switches, making them available in the argv array. This is a standard behavior for command line tools.


#13

Hello,

I did some research on this subject to find a solution. The suggested options in the FAQ Piwik FAQ didn’t have an effect on my php - piwik installation. I switched the adapter from PDO_MYSQL to MYSQLI an so on.

I debugged the archiv process and found a “zend_mm_heap corrupted”. This error triggered the segmentation fault.

The bug is a PHP Bug is at least noticed but not solved in the current PHP Versions, see zend_mm_heap Bug The thread started in 2007, so it may take some more time until it will be solved :wink:

I decided to make a “hack” in the index.php of my piwik installation to get rid of the segmentation fault. The code will be only executed when the script is executed from the command line. Here is the patch:

ONLY workes on PHP Versions > 5.3.x, see gc_disable !


echo '
#
# SegFault Error - archive.sh  (Debug-Error: "zend_mm_heap corrupted")
# siehe PHP Bug: https://bugs.php.net/bug.php?id=40479
#
if (php_sapi_name() == 'cli') {
        gc_disable();
}
' >> [your piwik installation path]/index.php

System Info:
PHP Version: 5.3.2-1ubuntu4.10
Piwik: 1.6
OS: Ubuntu 10.04.3 LTS


(Matthieu Aubry) #14

Octeny, thank you for the tip! I have updated the FAQ to link to your tip: Troubleshooting - Analytics Platform - Matomo


#15

Your Code do not run as it should.
This would work better.


echo '
#
# SegFault Error - archive.sh  (Debug-Error: "zend_mm_heap corrupted"winking smiley
# siehe PHP Bug: https://bugs.php.net/bug.php?id=40479
#
if (php_sapi_name() == \'cli\') {
        gc_disable();
}
' >> [your piwik installation path]/index.php

Edit: Tomorrow i can give a short response if it works.
It should be integrated in core then with some php check switchs.

Edit2: It works. please push direct to faq and into core.


#16

I am running on windows and also receiving the “zend_mm_heap corrupted” message every couple of times the archive runs. Any word on when this workaround will make it into the codebase?


(Nicolas Cynober) #17

I confirm the garbage collecting error is still an issue in fresh ubuntu installs.
Disabling GC in the CLI context is not a valid workaround as the archive script calls the API, which in my case is handled by php-fpm.

This brings me two questions:

  • Does someone have a better way to disabled GC during the archive process ?
  • Does someone know exactly which program is outdated ?

Here is what I have installed (default ubuntu repository):


Piwik 1.7.1
Ubuntu 11.10
Nginx 1.0.5
PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012 03:26:01)
Suhosin Patch 0.9.10
APC 3.1.7
MySQL client: 5.1.58 
GD 2.0
CURL 7.21.6 


(Matthieu Aubry) #18

To disable for CLI + when the archive.php is triggered, add this in the top of index.php piwik file:


#
# SegFault Error - archive.sh  (Debug-Error: "zend_mm_heap corrupted"winking smiley
# siehe PHP Bug: https://bugs.php.net/bug.php?id=40479
#
if (php_sapi_name() == 'cli'
|| (!empty($_GET['trigger']) && $_GET['trigger'] == 'archivephp')) {
        gc_disable();
}


(Nicolas Cynober) #19

Thanks matt. It works like a charm.


#20

http://www.infoocean.info/avatar2.jpgI’m also running archive.sh as root for the time being while I figure out why www-data doesn’t have write permissions where it needs. For now cron based archiving is working for me.