Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

DB Error #1146 - Can't open new ticket shows HTTP ERROR 500

Below is info i gathered, if im missing something ill be glad to supply it. Thank you for your help and time.



DB Error #1146

[SELECT `ost_sequence`.* FROM `ost_sequence` WHERE `ost_sequence`.`id` = ? ORDER BY `ost_sequence`.`name` ASC LIMIT 1] Table 'rmaadvan_portal.ost_sequence' doesn't exist

---- Backtrace ----
#0 (root)/include/mysqli.php(312): osTicket->logDBError('DB Error #1146', '[SELECT `ost_se...')
#1 (root)/include/class.orm.php(1029): db_prepare('SELECT `ost_seq...')
#2 (root)/include/class.orm.php(1024): MysqlExecutor->execute()
#3 (root)/include/class.orm.php(1092): MysqlExecutor->_prepare()
#4 (root)/include/class.orm.php(460): MysqlExecutor->getArray()
#5 (root)/include/class.orm.php(471): ModelInstanceIterator->fillTo(2147483647)
#6 (root)/include/class.orm.php(353): ModelInstanceIterator->asArray()
#7 (root)/include/class.orm.php(357): QuerySet->all()
#8 (root)/include/class.orm.php(178): QuerySet->one()
#9 (root)/include/class.config.php(638): VerySimpleModel::lookup('1')
#10 (root)/include/class.config.php(647): OsticketConfig->getDefaultSequence()
#11 (root)/include/class.topic.php(207): OsticketConfig->getNewTicketNumber()
#12 (root)/include/class.ticket.php(2804): Topic->getNewTicketNumber()
#13 (root)/open.php(42): Ticket::create(Array, Array, 'Web')
#14 {main}

Install info:

Server Information
osTicket Versionv1.9.15 (70898b3) —  Up to date
Web Server SoftwareApache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 PHP/5.3.29
MySQL Version5.5.34
PHP Version5.3.29


Front end attempt info.

The URL page isn’t working

URL is currently unable to handle this request.

HTTP ERROR 500

Comments

  • Upgrade your PHP to 5.4 please, and try again.
  • Got it installed and now i get this.

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@url and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


    Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 Server at url Port 80
  • Can you check your PHP error log and see if there is anything logged there?

    Can you create a test.php file.
    Put <?php phpinfo(); ?> in it.
    Put it in your web tree and open it using your web browser.
    This will tell us if the Webserver is properly parsing PHP.

    Also did you uninstall the old version first?
  • Sorry for delayed response I ran into several issues with other sites when i changed PHP to 5.4

    I did PHP info and it parsed out a huge amount of data. So im assuming thats working?

    My hosting company is softlayer, and i have a "dedicated server" which gives me SSH access, WHM & cPanel access. I ran the php change on WHM and compiled/processed the update request. It did not give me an option to un-install and update a new php version. It gave me a completed result, and no errors. Not sure if i did something wrong.

    DB Error #144

    [SELECT filedata FROM ost_file_chunk WHERE file_id=234 AND chunk_id=0] Table './osticket_portal/ost_file_chunk' is marked as crashed and last (automatic?) repair failed

    ---- Backtrace ----
    #0 (root)/include/mysqli.php(177): osTicket->logDBError('DB Error #144', '[SELECT filedat...')
    #1 (root)/include/class.file.php(847): db_query('SELECT filedata...')
    #2 (root)/include/class.file.php(761): AttachmentChunkedData->read()
    #3 (root)/include/class.file.php(121): FileStorageBackend->passthru()
    #4 (root)/include/class.file.php(186): AttachmentFile->sendData()
    #5 (root)/logo.php(27): AttachmentFile->display()
    #6 {main}

    -------------------------------------------------------------------------------------------------------------------------------------------------------------

    DB Error #1286

    [SELECT `ost_sequence`.* FROM `ost_sequence` WHERE `ost_sequence`.`id` = ? ORDER BY `ost_sequence`.`name` ASC LIMIT 1] Unknown storage engine 'InnoDB'

    ---- Backtrace ----
    #0 (root)/include/mysqli.php(312): osTicket->logDBError('DB Error #1286', '[SELECT `ost_se...')
    #1 (root)/include/class.orm.php(1029): db_prepare('SELECT `ost_seq...')
    #2 (root)/include/class.orm.php(1024): MysqlExecutor->execute()
    #3 (root)/include/class.orm.php(1092): MysqlExecutor->_prepare()
    #4 (root)/include/class.orm.php(460): MysqlExecutor->getArray()
    #5 (root)/include/class.orm.php(471): ModelInstanceIterator->fillTo(2147483647)
    #6 (root)/include/class.orm.php(353): ModelInstanceIterator->asArray()
    #7 (root)/include/class.orm.php(357): QuerySet->all()
    #8 (root)/include/class.orm.php(178): QuerySet->one()
    #9 (root)/include/class.config.php(638): VerySimpleModel::lookup('1')
    #10 (root)/include/class.config.php(647): OsticketConfig->getDefaultSequence()
    #11 (root)/include/class.topic.php(207): OsticketConfig->getNewTicketNumber()
    #12 (root)/include/class.ticket.php(2804): Topic->getNewTicketNumber()
    #13 (root)/open.php(42): Ticket::create(Array, Array, 'Web')
    #14 {main}

  • Can you post your /etc/my.cnf?

    I believe you might have a line skip-innodb or similar, which disables innodb.

    I would suggest running this too on your database, as it seems it has crashed table:

    mysqlcheck -r yourDB

    Thanks,
  • @Sperrow is pointing you in the right direction.

    Ensure that under [mysqld] you do not have a innodb = off or skip-innodb (or if running 5.5+ ignore-builtin-innodb) in your my.cnf.  Also make sure that when MySQL is loaded..  If you do, remove/change them and restart MySQL.
  • @ntozier, thank you for the help. Im confused as to why this is happening and trying to get it working for about a week now.
    I did make changes you suggested and restarted MySQL successfully.
    @Sperrow - /etc/my.cnf file contains:

    [mysqld]
    open_files_limit=20136
    default-storage-engine=MyISAM
    max_connections=500
    innodb_file_per_table=1

    --------------------------------------------------------------------------------------
    When i attempt mysqlcheck -r myDB, it crashes mysql on server
    the mysql database is stored in /dev/sda2 (/var2) when i do the repair attempt it creates a "ost_file_chunk.TMD" that grows and grows until it fills the directory up. my Original "ost_file_chunk.MYD (6.2GB)" is pretty large.
    Disk /dev/sda2 (/var)100 %image
    exim (exim-4.82-2.cp1136)failedimage
    exim-26failedimage
    clamdfailedimage
  • Can you give it more space so that the repair can finish?
  • I'm willing too, i just don't know how.
  • That's done at the OS level so not really something that we would be able to assist you with..  Can you talk to your system administrator.
  • @ntozier - The Hosting company tells me to talk to my system administrator, they only supply the hardware and electricity to "my server".

    Im actually going through the settings to see if anything tells me the space allocation.
  • edited December 2016
    Hello chino259,

    The file growing happens when you run mysqlcheck -r yourDB, because of the mechanic how it fixes the table, it create a copy of existing table (including indexes iirc), rebuilds it, then removes the temporary table and then moves to the next table. This is problematic if you have space issues.

    Usually, system default partition layout contains /tmp as a temp partition, which mysql is using to make this copy of table, if you do not have (as in your case by the looks of it) /tmp, it should be using /, can you please run this in mysql, this will tell you where it is storing temporary copies:
    SHOW VARIABLES LIKE 'tmpdir';

    If I remember correctly then you can edit location where it stores these temporary files by adding this to /etc/my.cnf (iirc this is the option which controls it), again after making changes to /etc/my.cnf always restart mysql:
    tmpdir = /whatewer/you/want

    You might want to change this location to a partition which has enough space to do this exercise (for example, by default RHEL variants allocate almost all space to /home, for different distros it might be different). As a rule of thumb - you must have DB size x2 available space on the same partition to perform repair, if you don't have it - you must use different partition.

    You have another option, to move whole mysql database to a different partition and create symbolic link to it, e.g. (any partition with enough space can be used in place of /usr), after doing this mysql restart is required:
    mv /var/lib/mysql/YourDB /usr/mysql/YourDB
    ln -s /var/lib/mysql/YourDB /usr/mysql/yourDB

    As for /etc/my.cnf, you might want to use this (I use 5.1.73, but it should not matter), beware, bind-address will make your mysql localhost only, thus you won't be able to connect to DB with external application, e.g., MySQL workbench:
    [mysqld]
    bind-address=127.0.0.1
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0

    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid


  • @sperrow - at this pont im willing to try anything. I tried making the tmp dir change to a drive with more space, and made the other sites on server start throwing mysql errors. I believe it was a permissions error, which i have no clue on how to give permissions to the drive/directory i used. If that is a good method to attempt the repair, im willing to go that route.

    Also ran SHOW VARIABLES LIKE 'tmpdir'; and it shows a /tmp directory exist but with only about 1GB of space.

    If not, moving the database to another drive, assuming it would work and address the for ever growing table some guidance on that would be great. do i have to run your suggested script all at once? or is it line 1, step 1 Line 2 Step 2?
    mv /var/lib/mysql/YourDB /usr/mysql/YourDB
    ln -s /var/lib/mysql/YourDB /usr/mysql/yourDB
  • Hello chino259,

    To make permissions change on the directory you specify as tmp, you must enter this:
    chmod 777 /path/to/new/tmp
    chmod +t /path/to/new/tmp

    What it will do:
    First command will allow _everyone_ to store files (First 7: Owner, Second 7: Group, Third 7: Other. Seven means: read/write/execute) - this is why other sites threw errors as they tried to save files to a directory which had probably default permissions, which are 755 (read/write/execute for Owner, which is root or your user, read/execute for Group/Other). (You can read more about this here)

    Second command will add stick bit to the directory (you can read about it here)

    Regarding database move, you must execute these commands once from your command line, please do change to the correct directory and correct db:
    mv /var/lib/mysql/YourDB /usr/mysql/YourDB
    ln -s /var/lib/mysql/YourDB /usr/mysql/yourDB

    First commands will move /var/lib/mysql/YourDB to /usr/mysql/YourDB, which basically will move your database out of default location of /var/lib/mysql/ to your specified location on another partition.

    Second command will create a symbolic link from /var/lib/mysql/YourDB to /usr/mysql/YourDB, symbolic link acts like a windows shortcut. Why a shortcut is required, you might ask? It is required because mysql is looking for databases in /var/lib/mysql. If the database or a link to database is not found, it won't see the database.

    Please note that you must change /var/lib/mysql/YourDB to your own database, e.g., osticket, or whatever you have called your osTicket database.

    This won't affect other databases in /var/lib/mysql/, so other sites won't be affected.

    P.S. Please do remember, that all of this is based on assumptions :) I have no precise information how your system is built, so I can't give you precise commands to execute, you must be very careful and have a contingency plan if something goes wrong, e.g., if your move command fails, make another command ready to move it back.
  • Sorry for super delayed response, i got side tracked with other tasks and the holidays.

    @sperrow - Followed your instructions and ran a repair via SSH on new location and it completed successfully, after that i moved files back into old location because site wouldnt load after i moved files from original location.

    Once moved back in, phpmyadmin wouldn't load/recognize the SQL files/info so i dropped table and reinstalled osticket to create tables again, then replaced with all .MYD, .MYI, .frm files from original install.

    Now, i know its a temporary fix since storeage was the issue that caused database to break and corrupt it.

    How can i make ost_file_chunk.MYD smaller?
  • Hello @chino259, no problem :)

    If I understand correctly, this table is used to store file attachments. I would suggest looking at this:
    Storage :: Attachments on the Filesystem, in http://osticket.com/download Plugins section. 

    This plugin saves attachments at specific location on the file system, so you could specify a path to the files in different partition, where you have the space available.

    That should sort out your issues. Although - word of warning, please do not forget to backup these files if you do backup of osticket, else your pictures/files/etc will be gone if your system crashes :)
Sign In or Register to comment.