My Albums reorder themselves

FellatedOne

Joined: 2003-12-15
Posts: 13
Posted: Mon, 2005-04-11 21:44

This is weird. For the past couple of months my albums have been realigning themselves to a specific order. It's always the same order but it's completely incorrect. It's almost a random order in how they are sequenced, with my dates all jumbled up, but it does it the same way each time.

I have to manually go in and reorder the albums (about 250 or so) but in a week or two or three it will reorder itself back to this format. Anything that I have added recently is added to the end (instead of the beginning where it belongs).

I am running:
http://gallery.milwaukeenights.com
Gallery v. 1.5 RC2
Apache: Unable to locate version
PHP 4.3.2
Toolkit: unknown
OS: Linux
Web Browser: IE and FF

If this is not a common problem, thats understandable (it's just the way it is with me) but is there a fast way to reorder all my albums by the date they were entered? Boy, that would save me about 2 hours of drudgery.....

 
FellatedOne

Joined: 2003-12-15
Posts: 13
Posted: Thu, 2005-04-14 23:17

No one else has ever experienced this?

Man.... am I odd man out.

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Thu, 2005-04-14 23:30

It sounds like gremlins :)

 
hacked

Joined: 2004-12-21
Posts: 7
Posted: Fri, 2005-04-15 23:12

Yes, I've seen this error too.

I recently moved web hosts *and* upgraded to 1.5-RC2 as part of the move. I got my gallery up and running on the new web host and things were going smoothly for a day or two. One morning I visited the page and found all the albums re-ordered without any explanation. The sorting was a bit bizarre, but I think the albums may have been sorted by file date... Oldest albums first.

I did a little investigating and came to the conclusion that the albumdb.dat file was likely corrupted, and that's what caused the problem. Gallery automatically "fixed" the corrupt DB by re-sorting the albums and updating the DB file. You can recreate the problem if you manually corrupt the DB file and add two "album 1" entries. However, I'm still not sure how the file was corrupted in the first place.

I fixed the problem by restoring an old version of the albumdb.dat file (along with a little bit of manual editing). I haven't seen the problem since (2 weeks now). I've also been backing up the albumdb.dat file anytime I add new albums.

Finally, I enabled file locking in the config.php file as a precaution.

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Sun, 2005-05-22 09:34

I had the same problem, I had to restore albundb.dat from backups.

This is the final straw for me with Gallery. It may not be cool to slag off OSS but Gallery for me has gone from being a quality project to junk.

Enough already.

 
FellatedOne

Joined: 2003-12-15
Posts: 13
Posted: Mon, 2005-05-30 17:12

Actually, I figured it out.

For whatever reason, when upgrading previous albums, my temp folder was not emptying itself. I would still have garbage temp files in there.

I simply emptied the temp folder after upgrading everything and have been cruising along smoothly ever since....

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Wed, 2005-06-08 22:13
dc2447 wrote:
I had the same problem, I had to restore albundb.dat from backups.

This is the final straw for me with Gallery. It may not be cool to slag off OSS but Gallery for me has gone from being a quality project to junk.

Enough already.

This has happended again to me - my gallery is in a right mess.

It would be nice if a Gallery developer could comment

 
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8194
Posted: Wed, 2005-06-08 22:34

We definitely try to give you the best product we can, but you must understand we're volunteers. We admit G1 has major design flaws, and we think we'll do better at addressing those with our new major version G2--you can even help us test it!

If you are not satisfied with our product, nobody is forcing you to use it. Also realize nobody is forcing us to help you.

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Wed, 2005-06-08 22:37

dc2447,

is your problem EXACLTY the same as the one from FellatedOne ?

I ask, because _i_ dont understand what you mean.
If its not the same problem i would like you to open a new thread and explain in detailed your problem.
The reason is a.) its better to have different things in differents threads and b.) my english is not that good (i am german)

Regards,

jens

P.S.: Hence my signature :)

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-06-09 01:12

I'm sorry that you feel that Gallery is junk. We do what we can in our spare time, and if that's not enough then you're free to pursue other alternatives and we wish you the best of luck.

If, on the other hand, you'd like to see us fix this problem then you might start by filing a bug with as much detail as you can muster about this and offering up constructive criticism. If you can think of any solutions, that would be a good place to suggest them.

My guess is that concurrent accesses to your albumdb.dat file are causing it to get corrupted. I'd look in your Apache error logs for any traces of crashed http servers. I'd also make regular backups of your albumdb.dat file so that you can roll back to that if necessary (good idea to back it up after you add new albums). And enable flock based locking where possible.

Also, consider moving forward to G2. One of the difficulties with G1 is that it's very difficult to manage concurrent file access without the possibility of corruption. G2 uses a database as a semaphore for concurrent access and as a result is much more reliable.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Fri, 2005-06-10 04:17
dc2447 wrote:
I had the same problem, I had to restore albundb.dat from backups.

It's happening with me too.. :/
(but im using 1.4.4 on that site)

 
wieland
wieland's picture

Joined: 2005-06-12
Posts: 1
Posted: Sun, 2005-06-12 21:41

hi guys. I have the exact nightmare problem. I found a temporal (dirty hack) solution.

In /classes/AlbumDB.php

comment following lines (from #35 and next ones)

if (strcmp($tmp, "")) {
$this->albumOrder = unserialize($tmp);

// albumdb.dat is corrupt, rebuild it
//if (empty($this->albumOrder)) {
//$this->albumOrder = array();
//}
//$changed = 1;

Greets!
Wieland Kublun
www.alohagdl.com Webmaster
www.kublun.com // personal website

 
Blinkiz
Blinkiz's picture

Joined: 2002-11-14
Posts: 36
Posted: Mon, 2005-07-04 17:24

I have the same problem on two of my customers sites.

The server (shared) was reinstalled. Gallery stopped working, so I installed Gallery 1.5 for them. It when fine.
But now gallery are losing the ordering of the albums quite often. It's a big problem because it's 180 albums and 10637 pictures in the gallery.

Does a tool exist to sort these by name or date?
I saw a note about update to G2. Does people recommend me to update my gallery to this version already?

 
fission

Joined: 2005-07-05
Posts: 8
Posted: Tue, 2005-07-05 13:25

I have the same problem as well. I have just a few top level albums (all containing multiple sub albums). I've noticed a few times now where i'll pull up my gallery site in a browser and the top level albums have mysteriously reordered themselves.

:: Running Gallery v1.5

- Lee

 
roi

Joined: 2004-02-12
Posts: 65
Posted: Tue, 2005-07-12 06:01

yea i have the same issue as well, been going on for a while but have not posted it thinking it would be happening to me only......... anyone else has a fix for this rather than the dirty hack solution?

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Sun, 2005-07-24 21:25

My apologies for not replying to this thread earlier, I don't seem to get email notifications from here very often (if at all)

Quote:
]I'm sorry that you feel that Gallery is junk. We do what we can in our spare time, and if that's not enough then you're free to pursue other alternatives and we wish you the best of luck.

I understand this and I apologies for the rude nature of the post, it was unwarranted. I have been using gallery for many years and it is only recently that I have started to have problems with it.

Quote:
If, on the other hand, you'd like to see us fix this problem then you might start by filing a bug with as much detail as you can muster about this and offering up constructive criticism. If you can think of any solutions, that would be a good place to suggest them.

If you think there is value in this then I'll certainly raise a bug report. I do of course keep backups but it's difficult to know where and when problem occur. When albumdb.dat gets corrupted the symptoms vary from albums being listed in entirely the wrong order to albums not appearing at the *top* of the album list.

Quote:
My guess is that concurrent accesses to your albumdb.dat file are causing it to get corrupted. I'd look in your Apache error logs for any traces of crashed http servers. I'd also make regular backups of your albumdb.dat file so that you can roll back to that if necessary (good idea to back it up after you add new albums). And enable flock based locking where possible.

Backup up after new album creatioon isn't really as easy as that as I have over 500 albums and many contributors.

Quote:
Also, consider moving forward to G2. One of the difficulties with G1 is that it's very difficult to manage concurrent file access without the possibility of corruption. G2 uses a database as a semaphore for concurrent access and as a result is much more reliable.

Will try that now

Quote:
If you are not satisfied with our product, nobody is forcing you to use it. Also realize nobody is forcing us to help you.

Nobody is forcing me to use gallery but I'm in a position where I have 15,000 images collected over the last years and now option of getting them out of gallery format into another gallery container, I have looked at the possibility of importing my gallery into something else without much luck

 
roi

Joined: 2004-02-12
Posts: 65
Posted: Mon, 2005-07-25 17:20
Tim_j wrote:
dc2447,

is your problem EXACLTY the same as the one from FellatedOne ?

I ask, because _i_ dont understand what you mean.
If its not the same problem i would like you to open a new thread and explain in detailed your problem.
The reason is a.) its better to have different things in differents threads and b.) my english is not that good (i am german)

Regards,

jens

P.S.: Hence my signature :)

ok the problem is that, lets say ur albums are ordered this way, 1, 2,3,4,5

and out of nowhere you look they are arranged 3,4,1,2

happends to my gallery all the time and to my clients gallery.

this is a known issue and a bug report has been submitted already, we just hope there is a solution.

today im emptyin the temp folder and id see how that works out.

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Sat, 2005-07-30 10:11

This problem is happening to me every couple of days now, my gallery is pretty much unusable at the moment. Every time this happens I have to restore from backups then move each album that has been created since to the top of the tree.

Is there any way to reorder the albums by creation date? AFAIKS this information isn't captured anywhere - is it?

WRT to apache errors the only ones I get are php maximum execution times - mine is set to 30 seconds and this:

Quote:
[Sat Jul 30 00:51:00 2005] [error] PHP Fatal error: Call to a member function on a non-object in /home2//public_html/gallery/classes/User.php on line 152

Quote:
[Sat Jul 30 09:42:10 2005] [error] [client 195.93.21.70] File does not exist: /home2/public_html/gallery/com/gallery/GalleryRemote/resources/GRResources_en_US.class

I am trialling g2 at the moment but integration seems to be a nightmare.

 
toastmaster

Joined: 2003-05-01
Posts: 219
Posted: Sat, 2005-07-30 17:31

Still happening in 1.5.1 RC1, which is a shame as it takes a while to sort it out each time. As this bug has been known about for at least 4 months, I was hoping it might be resolved now. Any news on a fix in a later release? Still love Gallery, though!

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Sat, 2005-07-30 18:29
toastmaster wrote:
Still happening in 1.5.1 RC1, which is a shame as it takes a while to sort it out each time. As this bug has been known about for at least 4 months, I was hoping it might be resolved now. Any news on a fix in a later release? Still love Gallery, though!

I suspect that issue is tricky to fix because of the limitation of the flat file database which holds the album data. Personally I think there needs to be a simple backup of albumsdb.dat everytime there is an operation on it.

I'm also confused by the suggestion that this is a locking issue as I'm pretty sure that the problem doesn't occur with concurrrent writes and if it was a locking issue I think the whole file would be truncated to a zero length file.

In fact looking at the code, flock() is indeed used to protect files getting opened and written to:


function safe_serialize($obj, $file) {
        global $gallery;

        if (!strcmp($gallery->app->use_flock, "yes")) {
                /* Acquire an advisory lock */
                $lockfd = fs_fopen("$file.lock", "a+");
                if (!$lockfd) {
                        echo gallery_error(sprintf(_("Could not open lock file (%s)!"),
                                                "$file.lock"));
                        return 0;
                }
                if (!flock($lockfd, LOCK_EX)) {
                        echo gallery_error(sprintf(_("Could not acquire lock (%s)!"),
                                                "$file.lock"));
                        return 0;
                }
        }
 
meri

Joined: 2003-04-04
Posts: 16
Posted: Sat, 2005-07-30 19:30
FellatedOne wrote:
Actually, I figured it out.

For whatever reason, when upgrading previous albums, my temp folder was not emptying itself. I would still have garbage temp files in there.

I simply emptied the temp folder after upgrading everything and have been cruising along smoothly ever since....

I saw one member FellatedOne suggesting that you empty the temp file. When I checked my file I saw a lot of files in there.

I wanted to know if these files are supposed to be there or is it safe to remove them?

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Sat, 2005-07-30 22:30

My gallery has just done this again and I have ended up with albums from 2000 at the top.

I'm left with the choice of either spending serious amounts of time fixing this every day or so or using G2 which, to be frank, doesn't look finished to me.

Gutted.

 
wolfeman

Joined: 2004-09-02
Posts: 25
Posted: Mon, 2005-08-01 23:01

I just wanted to chime in, just in case the info helps anyone.

Today my gallery front page [top level] reordered itself. I have 5 albums and 1 and 2 switched places along with 5 and 3

I manually reordered them back and everything else seemed fine, all nested galleries were untouched. This is the first time in my 2+ years of using gallery that anything like this has happened.

my current version of gallery is v. 1.5

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Wed, 2005-08-03 20:33

Again today

 
Jordan_01002

Joined: 2005-02-14
Posts: 1535
Posted: Thu, 2005-08-04 00:15

Have you tried G2?

 
dc2447

Joined: 2002-09-22
Posts: 130
Posted: Thu, 2005-08-04 07:40
Quote:
Have you tried G2?

I have and personally I don't think it's mature enough to move all 15,000 pictures to it yet

 
Jelly

Joined: 2005-01-15
Posts: 114
Posted: Thu, 2005-08-04 16:09

If G2 can look like G1 then i would consider moving to G2. I honestly dont like the layout nor all the "spam" on the main gallery index.

I have only had this problem happen to me 1 time. *knocks on wood*

But the temp files are a good question: What do they do? Is it ok or good to delete them?

 
roi

Joined: 2004-02-12
Posts: 65
Posted: Mon, 2005-08-08 06:30

yea i tried it deleted all temp file, but no same issue, question though why are the temp files not being deleted auto when the script is done with it ?

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Mon, 2005-08-08 10:08

Hello,

Signe and me think it could be related to a new piece of code.
But the code itself is correct and is there for good reason.

But you can remove it on your own risk.

classes/AlbumDB.php
remove:

// albumdb.dat is corrupt, rebuild it
                        if (empty($this->albumOrder)) {
                                $this->albumOrder = array();
                        }
                        $changed = 1;

jens

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Mon, 2005-08-08 12:02
dc2447 wrote:
I have and personally I don't think it's mature enough to move all 15,000 pictures to it yet

G2 is far, far more mature in respect to having as many images as you do. There is one commercial sites based on ALPHA versions of G2 that have more than 500,000 images and something like 50,000 users. I believe its "care2", though my figures could be a little off (higher now, i'd imagine). It scales very very well.

Jelly wrote:
If G2 can look like G1 then i would consider moving to G2. I honestly dont like the layout nor all the "spam" on the main gallery index.

You can customize G2 far more than you can G1, and its light years easier. There is a "classic" theme that includes the sub-album list like G1 can have. If you remove all the side-bar items, it will look even better. In the long term, you will almost certainly be happier and better served by G2. I would not recommend REMOVING your G1, but G2 will happily install alongside G1 and import data from it (not removing it from G1!) so you can test it out.

Jelly wrote:
I have only had this problem happen to me 1 time. *knocks on wood*

But the temp files are a good question: What do they do? Is it ok or good to delete them?

In linux, the /tmp dir is made to be entirely disposable. Its possible that if you nuke something WHILE its in use, some poor sap will have a minor issue or two, but thats about it. If you configured your own special /tmp dir for gallery (in your html doc root maybe?) then you won't be doing any damage unless someone happens to be uploading an image RIGHT at that moment. Some linux distributions actually clear the /tmp dir at every boot... though with linux, who knows if it would happen more than once a year :)

 
Leviathan

Joined: 2004-12-06
Posts: 16
Posted: Sun, 2005-08-28 09:35

This reorder issue has been happening to my large gallery quite often as well. It happens like every three days now, and takes quite a bit of time to fix the order of nearly 40 top level albums.

How does the albumdb.dat get corrupt?

Removing that bit of code in AlbumDB.php, what's that going to do? You said 'at your own risk', and that scares me. What happens when/if it goes corrupt and that bit of code is gone?

I'd love to upgrade to Gallery 2 (I use it on another site and love it) but I use gallery as a module for Postnuke and as far as I know, the new version doesn't integrate.

But Gallery still rocks.... I'll always love it.

 
rundfunk

Joined: 2005-08-24
Posts: 8
Posted: Sun, 2005-08-28 16:06

For those of you who've been experiencing this problem, you might try what I've done and restrict search engines from crawling the rss.php file. I had been experiencing this problem nightly, but after doing what I outlined in this thread, I haven't had the problem since. It seems that rapidly crawling the RSS feed was somehow causing the albumdb.dat file to be corrupted.

 
pauljsolomon

Joined: 2005-08-30
Posts: 1
Posted: Tue, 2005-08-30 15:24

I'm seeing this problem also (I have 1.5 installed). The only thing I might add is that I saw this problem when I was logged in as an admin (by mistake) on two different computers. Could this be causing the album.dat file corruption?

This is starting to get really annoying and I need to fix this soon!

-p.

 
rundfunk

Joined: 2005-08-24
Posts: 8
Posted: Wed, 2005-08-31 14:34

Other people are reporting that excluding their Gallery RSS feed from being crawled resolves this issue for them. I'd encourage any of you still experiencing this problem to try this work-around. (It's only a work-around, since it'd be preferable to have my RSS feeds available to search engines.)

 
madison

Joined: 2002-09-13
Posts: 20
Posted: Fri, 2005-09-02 11:46

I had this problem. I'm the only person that updates the gallery, so there was no simultaneous updating.

I found that it had something to do with eAccelerator... http://eaccelerator.net/HomeUk.

eAccelerator really sped of gallery, but at least once a day it would reorder the album. And it would reorder when just viewing the gallery!

Once I disabled eAccelerator for the gallery directory it stopped reordering.

 
mwhite1112

Joined: 2005-08-25
Posts: 2
Posted: Fri, 2005-09-02 14:21

Well i checked my error logs and i was missing the robots.txt file...somehow.

I used a robots.txt generator and set it to deny all and it's been ok for a day now :D

UPDATE : Still working like a charm...i guess setting the deny all in the txt file workz :D

~Mike

 
okra

Joined: 2004-06-25
Posts: 5
Posted: Mon, 2005-09-05 13:48

Same problem here. Around 200 albums all out of order now. I have no idea what event caused the sorting, seemed to order them by name of the album (the name that is used in the url)

I reordered the first page by hand, came back a couple days later and it had been reordered again.

Running Gallery 1.5.

 
Carl_in_Florida
Carl_in_Florida's picture

Joined: 2003-01-07
Posts: 110
Posted: Thu, 2005-09-08 14:01

repeatedly happening to me. gonna try the rss.php thing (i am just going to delete it)

Carl

 
RacerXRed

Joined: 2003-11-09
Posts: 38
Posted: Thu, 2005-10-20 03:37

Has anyone found a fix for this?? I tried removing the RSS part of my gallery, still doing the same thing. This is getting very annoying.

 
jennforman

Joined: 2004-04-23
Posts: 22
Posted: Wed, 2005-10-26 14:19

I have been struggling with this problem for months, it only seems to affect the top-level albums though. We have 11K photos with 10 top-level albums, not much uploading going on right now, simultaneous uploading would be very rare.

I tried creating a robot.txt file to deny access to rss.php but after a week the problem was still happening, so I have temporarily disabled my rss feed. Album order has been stable for 1 week, but this is a terrible workaround!

Where can we recommend that this bug be checked out for potential fixing in future 1.x versions, if it is not already?

(Running 1.5-pl1 on Solaris.)

 
blw91126

Joined: 2004-11-12
Posts: 81
Posted: Sun, 2005-10-30 15:00

I tried the robot.txt file also and it didn't help. Still haven't figured out how to fix the problem. It seems the support for gallery 1.x simply isn't there anymore. Not sure if anyone is concerned about the problem. The answer seems to be switch to Gallery 2. I wish it had some of the features I needed and I would. :(

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Mon, 2005-10-31 23:19

well..i could not fix it either..

 
scaturan
scaturan's picture

Joined: 2004-09-12
Posts: 1153
Posted: Tue, 2005-11-01 04:46

one of my users have made a complaint about this "reorder/shuffling" problem. his gallery is located at

http://hitosora.negimaki.com/gallery/

it used to look organized but now albums are in random order. now i'ts running g1.5.1 and we're not sure if that problem still exist. let me see if i can convince him to migrate to G2 and get it over with. :)

 
blw91126

Joined: 2004-11-12
Posts: 81
Posted: Sat, 2005-11-05 15:07

There has to be a fix for this, anyone? Been able to solve the problem?

 
jennforman

Joined: 2004-04-23
Posts: 22
Posted: Wed, 2005-11-09 02:52

I posted this in the 1.5.1 thread but did not get a response, so I am appending it here...

I am having a problem with my Gallery since upgrading to 1.5.1 in that the albums keep reordering themselves. Per discussion in this thread, I thought this was due to a corrupt album.dat file that was caused by repeated access of our rss.php file. However, I turned off rss in the config for two weeks and the problem was still occurring. I believe that the reorder is always back to the same exact wrong order each time.

Any suggestions?

Gallery URL: gallery.cs.umb.edu/gallery (rss is active but I just turned it back on as of Nov. 8, 2005)
Gallery version: 1.5.1
Apache version: httpd-2.0.54
PHP version: php-5.0.4
Graphics Toolkit: ImageMagick-6.1.8
Operating system: Solaris SunOS 5.8

 
jennforman

Joined: 2004-04-23
Posts: 22
Posted: Fri, 2005-11-18 02:58

Haven't gotten a response to this, so bumping up.

 
jennforman

Joined: 2004-04-23
Posts: 22
Posted: Mon, 2005-12-05 01:55

Thought I would bump this up one more time before I give up. :-(

 
toastmaster

Joined: 2003-05-01
Posts: 219
Posted: Fri, 2005-12-09 13:33

Damn damn damn! For some reason, I thought this has been taken care on in the 1.52 builds, so a couple of weeks ago, I went and took an evening re-sorting my albums back to the correct order, and everything was fine. This morning? Back in random order! I think I might remove the bit of "safety code" than Jens mentions further up the thread, and see how things go.

 
jennforman

Joined: 2004-04-23
Posts: 22
Posted: Fri, 2005-12-09 15:07

Please do post back here to let us know how it goes. I hesitate to remove code like that in case it hurts some other functionality of Gallery that will turn out to be important to our users, but it is very frustrating that I can no longer put the albums in an order that will make sense to the many visitors to our site.

 
joshwa

Joined: 2003-11-29
Posts: 9
Posted: Wed, 2006-08-02 11:20

My gallery has just done this as well v1.5.1 - you all talk about re-ordering your albums? How do you do this? I can't find the option to reorder my albums anywhere? Would really appreciate your help - thanks Josh

 
jennforman

Joined: 2004-04-23
Posts: 22
Posted: Wed, 2006-08-02 13:23

To reorder the albums on the top level, there is a "reorder album" link for each one, for me it is the third link in ([delete album] [move album] [reorder album]).

To reorder subalbums you can use the pull-down menu under the album thumbnail, reorder is the fourth one from the bottom on mine. Note that you cannot do this from *inside* the album you want to move.

Hope that helps, it is not so easy to explain in writing :-).

Also, be prepared for the corrupted album.dat (I think they decided that's what the problem is but I am not sure since it never got resolved) to reassert itself. We have never been able to predict when the un-ordering happens but when it does it usually occurs several times over the next several days. In fact things were nice and quiet for 4 months but just last week I laoded the main page and it was in the wrong order again...it is always the same wrong order too.