linkchecker crashed my entire server. I'm writing as much as I know about it.
In looking at mysql error log
I saw Out of memory error, needed first, 1048540 bytes
then repeated errors of 128000 bytes from linkchecker
After many of these warnings we have the error
disk is full
then my server crashed 100%, complete lock out, had to hard reboot.
After a complete reboot got warning messages on linkchecker_comments and linkchecker_boxes.
When into myPHPadmin to see both tables listed as "in use"
then the tables "did not exist" upon clicking on them in the top level structure of the database.
I then disabled link checker and then uninstalled, I got this warning from the uninstall, again showing two tables disappeared after the "out of memory" complete system crash.
user warning: Unknown table 'linkchecker_boxes' query: DROP TABLE linkchecker_boxes
user warning: Unknown table 'linkchecker_comments' query: DROP TABLE linkchecker_comments
At least you have an uninstall, which is good but I'm not sure exactly what the bug is here. I traced it to this module, but beyond that I'm not sure why it tried to use so much memory and after fail (I think), it crashed the entire server.
I think there was a memory leak or an out of bounds call with no error checking or something like that in the code when it rails against out of memory.
But corrupting two tables in the database is kind of amazing, so again I suspect missing error checking on a mysql query in the PHP.
Not sure, haven't looked at your source, just reporting what happened. Our site is massive with 7,000 articles and 25000 comments.
The module generally worked and helped me edit older articles with broken reference links, but can't afford a live server with a lot of traffic to crash in the middle of the night not detected for three hours.
Drupal 6.x.29, pathauto, path redirect, global redirect modules used.
Comments
Comment #1
hass commentedI have no idea why your disk was full nor why your server runs out of memory. Maybe your disk is tooo small and your memory limits, too. Via cron only 240 links are checked normally. This is no stress. Links are extracted once linkchecker has been enabled. The number of articles and comments sounds not that much. You can enable linkchecker again and run the link extraction. How many links are in linkchecker_links table and how many entries in the others? What sizes are the linkchecker tables in MB? Is this of type innodb? Single instance or per table db files? I wonder that the two tables have been lost. They are only read when cron runs.
Linkchecker may require a lot of memory, but only while extracting links. This does not happen at cron and only in the batch process. There is a known problem in 2.5 that is fixed in dev, but I suspect this could be a reason. You need to check all logs
Comment #2
RobertOak commentedno, sorry, it's not my server it's this module. My server resources are fine, memory usage < 10%, disk is 20% full, plenty of CPU, only 5% utilization, 8 cores, disk space and unused ram.
I'm telling you that your module made a wild memory request via mySQL and crashed my server. To fix it, after a hard reboot, it completely locked me out of the server, I had to uninstall your module as there were locked up tables that never released and were empty, warnings listed above after the hard reboot to the server.
Your module was the cause of hard "out of memory" and I already showed you the mysql error file shows an infinite loop out of memory errors until a hard crash but those out of memory errors were caused by your module's initial > 1MB query.
No, my.cnf, skip-innodb.
As I already said the linkchecker tables via myphpadmin were corrupted, locked after the massive memory usage request by your code, which I also list via the logs above, clearly I already checked the logs and why you have what I've got.
I'm telling you the tables in the database were "in use" plus "did not exist" so the massive memory request coming from your code not only hard crashed the server for 3 hrs but also corrupted the tables.
I'm not renabling this module on a live production server that has a lot of traffic, you need to check your own sandbox with a large database of links to check. But frankly I suspect something is not error checked in your code on mysql queries and possibly an loop situation that doesn't exit upon fail and I suspect it has something to do with content URLs are aliased, redirected or something along those lines. Possibly even after broken links are fixed on the 2nd pass via cron.
I don't have the time to debug your code to figure out the bug for you.
May I suggest you don't blame the messenger here? I wouldn't be bothering except this is clearly a dangerous bug to crash a server to complete lock out, hard reboot.
Comment #3
RobertOak commentedWell, I did do a quick vim of linkchecker.module and I do see an issue with auto_repair for 301s, line 424 and that would correspond with a 1045540 byte mysql query followed by a loop of 128800 byte queries.
If there was an error and a slew of 301s came back (I don't believe we have that many 301s yet, we do reference economic statistical sites so it's possible that a major site was moved, thus affecting many nodes).
Anyway, just doing a quick scan of the code I see no error checking for number of nodes to process in that while and then for loop starting at line 424. While you're limiting the number of links to check in cron, on line 424 I see no limit to 100 nodes. I see all nodes which match resulting 301 to be processed and that I think could cause a fatal out of memory error, esp. with nested loops.
Like I said, I can't hang out and debug this because it's not critical to our site and I'm busy rewriting other modules working on a major site upgrade, so that's my best guess on a quick scan.
Don't shoot the messenger.
Comment #4
hass commentedThe module has for sure no build in feature to destroy it's own tables or crash a server intentionally. Autorepair can cause thousands of nodes/blocks/comments to be updated for the same link. That's correct, but not very common. In such a case, just disable autorepair. It's disabled for this reason by default. I'm not sure what the problem could be with a 1mb query.
Have you set (http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html):
This is required by D6 and later.
Without being able to repro, nobody can help you and your details have not been helpful to identify a possible root cause. Without autorepair the module is harmless for sure.
Feel free to share a patch to limit the autorepair.
Comment #5
hass commentedThis should help, but does not remove the possible out of memory. However it recovers from out of memory situations itself.
D7: http://drupalcode.org/project/linkchecker.git/commit/4a8c1ad
Comment #6
RobertOak commentedYes, but again, that's not the issue, it's your code. You have nested loops, trying to process an unbounded number of nodes, at once. Beyond adding memory checking code before the loops, the loop structure should be broken down and rewritten so you process one node at a time to repair the broken link. Iteratively and probably set to a cron. That pretty much solves trying to use beyond system memory.
That's the bottom line, you don't write nested loops with the potential to be editing and rewriting an infinite number of node content database entries at a time, all resulting in multiple memory mallocs. This is a programming technique issue.
I'm not using this code frankly due to performance, load on a production site, doing my own MySQL queries in a dev. site. I already pointed to the coding flaws and it's your project so you should be looking at programming techniques that will keep you out of memory allocation trouble, as I'm outlining. These are very important concepts to learn so it's up to you to rewrite your nested loops to be iterative to update the database and demalloc your memory, as well as check system memory in your routine.
Comment #7
hass commentedThe module loads one node after the other. That's why it's able to recover from an OOM. The object variables are always overwritten by the next node/comment/block. So if PHP has no memory leaks and good garbadge collection, there may never be a problem except core memory caching may fire you to death. You may need to review the code. The main issue came from
node_load_multiple()as this has loaded all nodes at once into memory. However this cannot destroy, but overload a database server.Stop wining and share a patch or uninstall the module if you only like to complain, please. You are not required to use linkchecker and my spare time is limited.
Comment #8
RobertOak commentedlinkchecker.module, line 424
$res = db_query("SELECT * FROM {linkchecker_nodes} WHERE lid = %d", $link->lid);Gee, what could possibly go wrong? Hints: LIMIT, resource and free up memory after insert.
I am not using your code as repeatedly stated, hence I am not rewriting your code. As a developer, may I suggest you consider realizing there is a problem instead of continually getting pissy at the bug reporter. Looking anywhere else but linkercheck.module, line 424 and below won't fix your code.
The only reason I reported this is to warn others they could 100% crash their high traffic production site due to these coding errors.
Comment #9
hass commentedI'm aware of LIMIT, but it's not realistic that these OOM limits are reached soon. To solve this issues I waited for Queue API that's only available since D7.
The free memory issue of inserts has nothing to do with Drupal at all. It's specific to CodeIgniter.
Again, linkchecker does not crash any site and nobody asked you to fan fear for nothing. As you are not using linkchecker, great - your site cannot crash. This is a high code quality module and developed in free time for no money at all. I only see a leecher here who do not contribute anything to d.o.
If you'd like to help solving issues and optimize performance - feel free to provide patches or learn how community works first. Why are you here - insulting? Go out of my queues, please. Here is end of free support.
Comment #10
RobertOak commentedDenial is an amazing thing and yes, it will never get someone a paycheck in software engineering. It did and will crash a server under the conditions I have outlined repeatedly and perhaps you need a good sandbox to play in considering your never ending insults to the bug reporter.
Comment #11
hass commentedComment #12
hass commentedMissed one http://drupalcode.org/project/linkchecker.git/commit/85ff418
Comment #13.0
(not verified) commentedadded drupal ver. possible modules to interact w/ linkchecker