Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006

    Unhappy Unanswered: Very strange db problem. Please help.

    I am a new user for this forum.
    First of all, I send my love to all of the forum users.

    I think have a lot of experiences on Perl language. But I am not the same on linux and on hardware's.

    On my website, I always use databases for small small data's which are not longer than 80 characters.

    I recently have some very strange behaviors of my db files.
    And they do these strange behaviors only a few times. Not for all of the process.

    Those strange behaviors are listed below:

    1-) It sometimes can not read any of the keys and values in my db files.

    2-) Sometimes I can not delete a key in the db files.

    3-) Sometimes I can not overwrite in the values.

    4-) Sometimes I can not ad a new key into the db files.

    Note: I have tested always for the same kind of process.
    That makes me very crazy.
    Everything is same but its behaviors are not always correct.
    Or even its behaviors are not always incorrect.

    Same db file.
    Same process.
    Same user.
    Same kind of key. ( Sometimes even the same key)
    Same kind of value. ( Sometimes even the same value)
    Same server ( Nobody touch it. it is a dedicated server)
    Same script.
    Same code of the script.
    Same Perl and linux version.

    I can not understand what changes. If there is a mistake somewhere, why it doesn't do it for each time.

    I have even tested by suspending the visitors to be sure to have my tests by a same environment.

    This script and also this kind of scripts have been working without any problem for 5 years by the same codes.
    This problem has been started just two weeks ago, even I did not change anything on server or on the scripts.

    It makes this mistakes both on large db's or small db's. It even makes it on a new db.

    I even replaced my Hard drive and put a SCSI hdd in it but its still same.

    These are all what I have done to discover the problem:

    1- Changed the hard disk drive.
    2- Upgraded the Active perl from v5.8.0 to v5.8.7 .
    3- Upgraded the Readhat Linux from i386 to i686 .
    4- Tested the related db code alone in another test script without the other codes.
    5- Virus scan on my computer. ( It makes it for my members too.)
    6- Tested on a new domain name on the same server.
    7- Tested by tie and dbmopen function.
    8- Tested by a new db name and new hash name with flock and also without flock.
    9- Many times deleted the db file and re-create a new one.
    10- Many times rebooted the server.

    There is also no period for this strange behaviors. It sometimes makes it for the first process
    and sometimes after 100 processes.

    Note: Sometimes it makes it for each process for especially for a certain key.
    You can never delete or modify (Overwrite on its value) this certain key when it makes it.

    Here are my some test results while this problem happens:

    Test1 code:

    print "ds: $in{'ds'}\n";

    unless (dbmopen(%taldat, "$kl/tr-tal/taldat", 0666)) { print "first reason: $!\n"; }
    unless ($taldat{$in{'ds'}}="$yerelkod<$baskayer$bolge<$yz fiat<L>$klsh/$klsemt/e/$sn") { print "second reason: $!\n"; }

    Test1 only prints this:
    ds: 17
    second reason: No such file or directory

    Test2 code:

    print "ds: $in{'ds'}\n";

    if (dbmopen(%taldat, "$kl/tr-tal/taldat", 0666)) { print "Database has been tied.\n"; }
    if ($taldat{$in{'ds'}}="$yerelkod<$baskayer$bolge<$yz fiat<L>$klsh/$klsemt/e/$sn") { print "$in{'ds'} has been added.\n"; }
    else { print "reason: $!\n"; }

    Test2 only prints this:
    ds: 17
    Database has been tied.
    reason: No such file or directory

    Note: !! This is very interesting. Database has been tied but No such file or directory.

    Test3 code:
    print "ds: $in{'ds'}\n";

    if (dbmopen(%taldat, "$kl/tr-tal/taldat", 0666)) { print "Database has been tied.\n"; }

    print "ds value: $taldat{$in{'ds'}}\n";

    if (delete $taldat{$in{'ds'}}) { print "$in{'ds'} has been deleted from database.\n"; }
    else { print "$in{'ds'} could not be deleted from database. reason: $!\n"; }

    Test3 only prints this:
    ds: 34
    Database has been tied.
    ds value: YSai<Sale<100.000 USD<L>files/property/e/eleni.html
    34 could not be deleted from database. reason: Bad File Descriptor

    Test4 code:
    print "ds: $in{'ds'}\n";

    if (dbmopen(%taldat, "$kl/tr-tal/taldat", 0666)) { print "Database has been tied.\n"; }

    $taldat{$in{'ds'}}='This is the new value';



    if (dbmopen(%taldat, "$kl/tr-tal/taldat", 0666)) { print "Database has been tied again.\n"; }

    print "ds value: $taldat{$in{'ds'}}\n";

    Test3 only prints this:
    ds: 34
    Database has been tied.
    Database has been tied again.
    ds value: YSai<Sale<100.000 USD<L>files/property/e/eleni.html

    Note: No deletion and no modify. Especially for a certain key. not for others.

    I have done many kind of tests. These are only some of them above.
    It does what I want at the most of my tries. That means my codes have no mistakes.
    It usualy only makes these strange things about one time in one or 200 tries.
    But it sometimes makes it each time, for a random certain key.
    For example it makes all deletions or modifies for the keys 15, 16 , 17 , 18 and 21 but not for key 20 .

    Now I get suspicious from my CPU.
    But I can not say to my server company to replace my CPU only for a guess.

    Is it possible that a CPU cause this kind of strange things ?
    What cause the "Bad File Descriptor" error ? If I do something wrong, why I did not get this error until now ?
    ( My scripts are 5 years old. )

    I have really nearly no sleep almost two weeks time.

    I please any comments from all of the users.
    Please write something even if you have no idea, that I do not feel myself lonely in the world.

    I am very sorry for my broken English.
    I hope I could tell what I wish to tell.

    Best regards for all of you.

    Awaiting for your responses.

    Okan Dunya

  2. #2
    Join Date
    Jul 2005
    UK, England
    Try adding the following to the top of your scripts:

    use strict "vars"
    use strict "subs"

    You may have some bad coding.
    I'm thinking......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts