You are here: Home / Journal / Coppermine “batch-add” hangs

Coppermine “batch-add” hangs

Just occasionally one stumbles across a small but very annoying problem, that takes ages to hunt down a fix. However, when you do stumble across the solution, you find it was just one tiny mistake – that should never have been made in the first place.

On our site http://www.garfnet.org.uk/coppermine we use a special Coppermine feature that allows us to add a number of files at once. It is only available to site admins but the site would be almost impossible to run with out it. The problem was that the “batch add files” button  did not respond when we clicked it. Instead, the existing page just hung and after several minutes the browser showed a “Page cannot be displayed” error. I was really tearing my hair out. Even got my Chris Attewell, our ISP physically to reboot the machine.

Fortunately, we use SSH (secure shell) to control our servers remotely and when I ran “top” (a Linux program that shows memory and processor usage), every time someone clicked the “batch-add” button and the “searchnew.php” script was activated, an Apache2 process snaffled 99% of the machine’s processor resources and the rest of the machines services ran at a snail’s pace. This lasted until eventually “searchnew.php” script timed out. However there were no Coppermine or MySQL/PHP error messages and nothing unusual in either the Apache access or error logs.

I even installed a second Coppermine with a blank dataset and no files. Initially this ran fine – whch eliminated any MySQL & PHP issues – though we regularly “apt-get upgrade” for security reasons anyway. However when I copied our image files to the new installation the “batch-add” also failed – even before I had started to populate the new Coppermine database. This suggested that the problem may lie with our files and not with Coppermine.

So I used Konquerer (part of the KDE desktop for Linux) “fish” protocol securely to browse the files on our server (much more secure than FTP). That is when I stumbled across the problem. It was caused by circular symbolic links – and frankly gross stupidity on my part for allowing the situation to occur in the first place! Let me explain…

Unix allows you to create links to other files and folders as if they were in your current folder. In my case…

  • There was a symlink from /var/www/garfnet/coppermine/albums to /var/www/garfnet/media.
  • There was a second symlink from /var/www/garfnet/media to /var/www/garfnet/sounds. So far so good.
  • However a third link from /var/www/garfnet/sounds to /var/www/garfnet/coppermine meant that whenever the “searchnew.php” went hunting for files, it was going round in circles. 

Deleting that third symlink fixed the issue instantly and the system is working fine again – though I am finding it hard to come to terms with my embarrassment! Anyway, the moral of the story is that a “batch-add” not responding issue could be related to your file structure rather than to Coppermine. Or perhaps the moral is, don’t drink too much Jagermeister whilst creating symlinks.

In any event, I hope this is of some help to someone.