SolidCharity / LightBuildServer

LightBuildServer for building rpm and deb packages and running CI scripts, using linux containers
BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

locked database prevents from build jobs being started #148

Open tpokorra opened 8 years ago

tpokorra commented 8 years ago
--- Logging error ---
Traceback (most recent call last):
  File "/usr/share/lightbuildserver/web/lbs.py", line 86, in processbuildqueue
    self.LBS.ProcessBuildQueue()
  File "/usr/share/lightbuildserver/web/../lib/LightBuildServer.py", line 455, in ProcessBuildQueue
    self.attemptToFindBuildMachine(con, row)
  File "/usr/share/lightbuildserver/web/../lib/LightBuildServer.py", line 435, in attemptToFindBuildMachine
    buildmachine=self.GetAvailableBuildMachine(con,username,projectname,packagename,branchname,lxcdistro,lxcrelease,lxcarch,AvoidDocker,AvoidLXC)
  File "/usr/share/lightbuildserver/web/../lib/LightBuildServer.py", line 155, in GetAvailableBuildMachine
    cursor.execute(stmt)
sqlite3.OperationalError: database is locked

Later (might be unrelated):

stopping machine build02.lbs.solidcharity.com because of hanging build
ReleaseMachine build02.lbs.solidcharity.com
tpokorra commented 8 years ago

the question is why do we need an increased timeout? which query is blocking the database for so long?

tpokorra commented 8 years ago

is it the logs writing quite often to the database?

should we offer an alternative db access method for Mysql? modify ConnectDatabase

need to convert existing sqlite database to mysql? http://stackoverflow.com/a/1067365/1632368

or first try to work with a single db connection, rather than creating a new connection for each method? Problem both Logger and Lightbuildserver.py need to have a connection

tpokorra commented 8 years ago

Fedora23, mysql:

dnf install python3-mysql mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysql
    CREATE DATABASE lbs  DEFAULT CHARACTER SET utf8   DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON lbs.* TO lbs@localhost IDENTIFIED BY 'secret';
# open lbs in webbrowser, that should create the database
sqlite3 /var/lib/lightbuildserver/db/lightbuildserver.db .dump > my.sql
#  only need the insert statements for table build
# :%s/"build"/`build`(id,status,username,projectname,packagename,branchname,distro,`release`,arch,dependsOnOtherProjects,buildmachine,started,finished, buildsuccess, buildnumber, hanging, avoidlxc,avoiddocker)/g
# instead of sequences: ALTER TABLE build AUTO_INCREMENT=5000;