<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/poky.git/bitbake/lib/prserv, branch krogoth-15.0.2</title>
<subtitle>Mirror of git.yoctoproject.org/poky</subtitle>
<id>https://git.enea.com/cgit/linux/poky.git/atom?h=krogoth-15.0.2</id>
<link rel='self' href='https://git.enea.com/cgit/linux/poky.git/atom?h=krogoth-15.0.2'/>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/'/>
<updated>2016-02-26T17:20:31+00:00</updated>
<entry>
<title>bitbake: prserv: Add dump_db()</title>
<updated>2016-02-26T17:20:31+00:00</updated>
<author>
<name>Haris Okanovic</name>
<email>haris.okanovic@ni.com</email>
</author>
<published>2016-02-23T17:36:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=4a12865c7b8a534ac7f7c1380c549c5392eda5f5'/>
<id>urn:sha1:4a12865c7b8a534ac7f7c1380c549c5392eda5f5</id>
<content type='text'>
Returns a script (string) that reconstructs the state of the
entire database at the time this function is called. The script
language is defined by the backing database engine, which is a
function of server configuration.
Returns None if the database engine does not support dumping to
script or if some other error is encountered in processing.

The SQLite3 implementation in db.py calls iterdump() [1] to generate
a script. iterdump() is the library equivalent of the `sqlite3 .dump`
shell command, and the scripts are compatible. Execute the script in
an empty SQLite3 database using the sqlite3 utility to restore a backup
of prserv.

Use case: Backup a live PR server database in a non-racy way, such
that one could snapshot the entire database after a set of bitbake
builds all using a shared server. I.e. All changes made prior to
the start of a dump_db() operation should be committed and captured
in the script. Subsequent changes made during the backup process are
not guaranteed to be captured.

Testing: ~7MB database backs up in ~1s while PR server is under load
from 32 thread bitbake builds on two separate machines.

[1] https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.iterdump

(Bitbake rev: 004003daf6bd0f0233ce5c2d95f1d7d64ab91bb3)

Signed-off-by: Haris Okanovic &lt;haris.okanovic@ni.com&gt;
Reviewed-by: Ken Sharp &lt;ken.sharp@ni.com&gt;
Reviewed-by: Bill Pittman &lt;bill.pittman@ni.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: bitbake: prserv: do not clear umask when daemonizing</title>
<updated>2016-02-04T23:47:48+00:00</updated>
<author>
<name>Diego Santa Cruz</name>
<email>Diego.SantaCruz@spinetix.com</email>
</author>
<published>2016-02-02T12:08:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=56454f6fb2aed2bbfd6e1c1759f15d97db086d90'/>
<id>urn:sha1:56454f6fb2aed2bbfd6e1c1759f15d97db086d90</id>
<content type='text'>
Clearing the umask when daemonizing is not the correct thing
to do, as it will create files writable by anyone by default.
For instance the pid file was being created with mode 777.
This could also potentially affect the sqlite database.
Better let the calling process decide on the umask.

[YOCTO #9036]

(Bitbake rev: ff6d3f53a4504eae7ec4c190b9f7595b09aed017)

Signed-off-by: Diego Santa Cruz &lt;Diego.SantaCruz@spinetix.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: bitbake: prserv: SIGTERM handling hung process</title>
<updated>2016-02-04T23:47:48+00:00</updated>
<author>
<name>Diego Santa Cruz</name>
<email>Diego.SantaCruz@spinetix.com</email>
</author>
<published>2016-02-02T12:05:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=abf8a8fbc35c8d45c2357701400477792e39f80e'/>
<id>urn:sha1:abf8a8fbc35c8d45c2357701400477792e39f80e</id>
<content type='text'>
The current SIGTERM handler hungs the process instead of
making it exit. The problem seems to be that the handler thread
is not signaled to quit, so it stays there doing its work, as
it is not a daemon thread. Setting the quit variable fixes this.

While at it, to not use the SystemExit exception to terminate
upon SIGTERM but instead left the quit flag do its job. This way
the PID file is properly removed.

[YOCTO #9035]

(Bitbake rev: 655ec800d54da581229f12efb6f0baf54975fed4)

Signed-off-by: Diego Santa Cruz &lt;Diego.SantaCruz@spinetix.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: bitbake: prserv: -wal and -shm sqlite lost when daemonizing</title>
<updated>2016-02-04T23:47:48+00:00</updated>
<author>
<name>Diego Santa Cruz</name>
<email>Diego.SantaCruz@spinetix.com</email>
</author>
<published>2016-02-02T12:04:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=be032fc40eb315841fdd1f69c780726619ea1bad'/>
<id>urn:sha1:be032fc40eb315841fdd1f69c780726619ea1bad</id>
<content type='text'>
When daemonizing the PR service the -wal and -shm sqlite files were
being deleted, although they should never be. While the daemonized
process keeps the file descriptors open and thus a clean exit does
not loose any data, a power outage would loose all data in the WAL.
Removing these files also breaks sqlite collaboration between
processes and furthermore prevents taking proper backups without
stopping the PR service.

The reason this happens is that the DB connection is opened in
the initial process, before forking for daemonization. When the
DB connection is closed by the exiting parent processes it can
delete the -wal and -shm files if it considers itself to be the
last connection to the DB. This is easily fixed by opening the
DB connection after all forking.

[YOCTO #9034]

(Bitbake rev: bc867c81e3894da5bdd2e45fa695bb5f5f1bb58b)

Signed-off-by: Diego Santa Cruz &lt;Diego.SantaCruz@spinetix.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: bitbake: Set process names to be meaninful</title>
<updated>2016-01-30T11:43:56+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2016-01-29T11:08:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=5375e6431c0475b1a266d481af2af5187dbf99f2'/>
<id>urn:sha1:5375e6431c0475b1a266d481af2af5187dbf99f2</id>
<content type='text'>
This means that when you view the process tree, the processes
have meaningful names, aiding debugging:

$ pstree -p 30021
bash(30021)───KnottyUI(115579)───Cooker(115590)─┬─PRServ(115592)───{PRServ Handler}(115593)
                                                ├─Worker(115630)───bash:sleep(115631)───run.do_sleep.11(115633)───sleep(115634)
                                                └─{ProcessEQueue}(115591)

$ pstree -p 30021
bash(30021)───KnottyUI(117319)───Cooker(117330)─┬─Cooker(117335)
                                                ├─PRServ(117332)───{PRServ Handler}(117333)
                                                ├─Parser-1:2(117336)
                                                └─{ProcessEQueue}(117331)

Applies to parse threads, PR Server, cooker, the workers and execution
threads, working within the 16 character limit as best we can.

Needed to tweak the bitbake-worker magic values to tell the
workers apart.

(Bitbake rev: 539726a3b2202249a3f148d99e08909cb61902a5)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: prserv/serv.py: Better messaging when starting/stopping the server with port=0</title>
<updated>2015-09-28T11:00:33+00:00</updated>
<author>
<name>Leonardo Sandoval</name>
<email>leonardo.sandoval.gonzalez@linux.intel.com</email>
</author>
<published>2015-09-10T11:59:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=f78f90240a3041be426c6ba9085849352164ee8b'/>
<id>urn:sha1:f78f90240a3041be426c6ba9085849352164ee8b</id>
<content type='text'>
When starting the server using port=0, the server actually starts with a
different port, so print a message with this new value. When stopping the
server with port=0, advise the user which ports the server is listening to,
so next time it tries to close it, user can pick up the correct one.

[YOCTO #8560]

(Bitbake rev: 851e53a216682fc9133f51c05a24527cfc677741)

Signed-off-by: Leonardo Sandoval &lt;leonardo.sandoval.gonzalez@linux.intel.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: prserv/serv: Close the DB connection out of class destructor</title>
<updated>2015-09-28T11:00:32+00:00</updated>
<author>
<name>Leonardo Sandoval</name>
<email>leonardo.sandoval.gonzalez@linux.intel.com</email>
</author>
<published>2015-09-23T13:39:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=134b267ebbcbf7a7bc43915e204da776530911d4'/>
<id>urn:sha1:134b267ebbcbf7a7bc43915e204da776530911d4</id>
<content type='text'>
When launching the PR server daemon, the PRData __del__ function was being
called (no reason found yet) where the DB connection closed, thus following
PR updates were not getting into the DB. This patch closes the connection
explicitly, not relaying on the __del__ function execution.
Closing the connection in turn causes all WAL file transactions to be moved
into the database (checkpoint), thus effectively updating the database.

[YOCTO #8215]

(Bitbake rev: c1b4754f69003df1a83fafc1c80a9ef74400b6dd)

Signed-off-by: Leonardo Sandoval &lt;leonardo.sandoval.gonzalez@linux.intel.com&gt;
Signed-off-by: Ross Burton &lt;ross.burton@intel.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: prserv/serv: Start/Stop daemon using ip instead of host</title>
<updated>2015-09-24T16:55:05+00:00</updated>
<author>
<name>Leonardo Sandoval</name>
<email>leonardo.sandoval.gonzalez@linux.intel.com</email>
</author>
<published>2015-09-15T14:59:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=5a51fb28dbdfcae8ceb503a5290532dd38aeb09f'/>
<id>urn:sha1:5a51fb28dbdfcae8ceb503a5290532dd38aeb09f</id>
<content type='text'>
In cases where hostname is given instead of an IP (i.e. localhost
instead of 127.0.0.1) when stopping the server with bitbake-prserv --stop,
the server shows a misleading message indicating that the daemon was not
found, where it is actually stopped. This patch converts host to IP values
before starting/stopping the daemon, so it will always work on IP, not on
hostnames, avoiding problems like the latter.

[YOCTO #8258]

(Bitbake rev: bd6398e967c234e89d773f509512ebf460fa76ff)

Signed-off-by: Leonardo Sandoval &lt;leonardo.sandoval.gonzalez@linux.intel.com&gt;
Signed-off-by: Ross Burton &lt;ross.burton@intel.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: prserv: SIGTERM and deamonization fixes</title>
<updated>2015-09-09T13:27:56+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2015-09-08T22:32:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=85256c8fa986f2a3258e75a22bb8d0656ffa41bf'/>
<id>urn:sha1:85256c8fa986f2a3258e75a22bb8d0656ffa41bf</id>
<content type='text'>
Worryingly, if you SIGKILL the bitbake cooker, an autostarted PR server
will remain behind. It turns out there are a few things we should do:

* The PR service doesn't need to daemonize when started from cooker,
  it just complicated the process lifecycle. Add a fork() method
  to handle this and use the non-daemon mode for the singleton.

* Reset the sigterm and sigint handlers. Bitbake cooker installs its
  own which we inherit meaning PR server was ignoring SIGTERM. Installing
  our own handlers which include a sync makes most sense here. Since
  we're in the code, make it sync the database on SIGINT.

* Use the new bb.utils.signal_on_parent_exit() call so that we get a
  SIGTERM when the parent (usually cooker) exits and we can shutdown
  too. Alternatives would be having an open pipe or polling
  os.getppid() for changes but this seems more effective.

(Bitbake rev: 05d31fa1f56bd3d3d363a16a421d9ba7541d4293)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: prserv/db: Document history modes</title>
<updated>2015-07-12T21:50:40+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2015-07-10T13:13:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=625a6bf6e813c7b753a9379151c95a4bbc6865c3'/>
<id>urn:sha1:625a6bf6e813c7b753a9379151c95a4bbc6865c3</id>
<content type='text'>
I keep having to dig into the archives to remember this information.
Add it as a comment to the file instead.

(Bitbake rev: 21dce82056887d8d28edde61b1b82f78bdf7613c)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
</feed>
