subscribe to this blog

CubicWeb Blog

News about the framework and its uses.

Debugging a memory leak in a cube

2010/09/24

We recently discovered that the cubicweb.org site (the one you are probably visiting right now) was suffering from a memory leak. The munin graphs showed a memory consumption steadily increasing soon after the instance was started, and this would only stop when all the memory on the host was exhausted. This was clearly caused by a memory leak somewhere, either in CubicWeb itself or in a cube used by the instance.

Munin graphs showing the memory leak in cubicweb.org

Fig. 1: Munin graphs showing the memory leak in cubicweb.org

Notice the associated service downtimes, and the stabilized memory consumption on Sept 23, after the leak was fixed.

Since Python has a garbage collector, either the leak was occuring in a C extension, or it was caused by some objects which were not garbage collectable. A common cause for the latter, as explained in the gc module documentation, are objects with a __del__ method which are part of a cycle.

We used the "gc" view, which is an administrative view in CubicWeb, reachable by appending "?vid=gc" at the end of the url of the root of your instance, if you are a member of the managers group. This view uses the gc module from the python standard library to see which objects are not garbage collected.

This view showed thousands of instances of mercurial.url.httphandler. This class indeed has a __del__ method and instances have a cycle with urllib2.OpenerDirector. Mercurial is used by the vcsfile cube which regularly polls remote repository over HTTP, which causes httphandler to be instantiated (and a reference to be leaked). This problem had gone undetected in mercurial because most of the time, processes using mercurial over http are shortlived and the leaked memory is quickly collected by the operating system. Discussion ensued on the IRC forum #mercurial with the developers and a patch was submitted which fixes the leak. In order to avoid the problem with versions of mercurial up to the current one, a new version of vcsfile including a monkey patch for mercurial was released and deployed on cubicweb.org!


We'll be attending the Paris Web 2010 conference

2010/09/09 by Arthur Lutz

A few of us from Logilab will be attending the Paris Web 2010 conference. This is the fifth edition of the conference and we're looking forward to some of the conferences. It's a bit of a shame that the web site of the conference does not offer the attendees the possibility of building your own schedule by virtually "registering" to certain talks. This is one of the cool things about cubicweb-conference, a cubicweb application that helps build websites for organizing and hosting conferences.

http://www.cubicweb.org/file/1251255?vid=download

We're glad there will be talks about the semantic web, accessibility, html5, css, javascript, etc...

I recently discovered Lanyrd which claims to be a social conference directory, with your twitter account you can track or show that you will be attending a conference. Twittter and identi.ca can be a good way of following a conference that you cannot physically attend. Check out Paris Web 2010 on Lanyrd : http://lanyrd.com/2010/parisweb/


Summer CubicWeb/Narval Sprint - Final report

2010/08/18 by Sylvain Thenault

For that last sprint day, each team made some nice achievements:

  • Steph & Alain worked on the mv/cp actions implementation to makes them working properly and supporting globs. Last but not least, with a full set of tests.
  • Alex & Charles got back what we call apycot 'full' tests, eg running test with coverage enabled, checking that code coverage is greater than a given threshold, but also running pylint and checking that its global evaluation is at least 7 (configurable, of course).
  • Katia & Aurélien provided a sharp implementation of recipe checking, so that we know we don't launch a recipe badly constructed, as well as informing the user nicely from what errors his recipe suffer.
  • Julien managed to set up a recipe managing from Debian package construction to Debian repository publication, going through lintian on the way
  • Pierre-Yves helped other teams to solve the narval related bugs they encountered, and finished by writing a thread-safe implementation of apycot's writer so we can run several checker simultaneously.
  • Celso continued working on a proof of concept blue-theme cube, wondering how to make CubicWeb looks nicer and be easily customisable in future versions.
  • Sylvain helped there and there and integrated patches...

So we finally didn't get up to the demo. But we now have everything to set it up, so I've a good hope that we will have a beta version of our brand new production chain up and running before the end of August!

Thanks to everyone for all this good work, and for this time spent all together!


CubicWeb gets press coverage at SemanticWeb.com

2010/08/15 by Nicolas Chauvat

Following the presentation of CubicWeb at OSCON 2010 in July, the editor of SemanticWeb.com wrote an article describing the CubicWeb framwork. Read the article and ask your questions on the mailing list!


Summer CubicWeb/Narval Sprint - Day 4

2010/08/13 by Pierre-Yves David

In this fourth day of the our Summer Sprint important progress have been made.

  • Stéphanie and Alain cleaned up the Apycot's bot sources from deprecated code and rewrite part of the test suite to follow the new way to launch apycot. They cleaned up the handling of VCS sources for tested project taking advantages of the new mercurial cache for vcsfile implemented by Katia and Aurélien last Tuesday. This feature keep a local clone of the remote repository and allow much faster checkout during test runs.
  • Julien made significant progress in the writing of the Debian recipe. A recipes can now successfully build Debian packages of a project and validate them with lintian and lgp. He later paired with Pierre-Yves and they improved the annotation of Apycot's Narval variable to enhance Input validation in Apycot's Narval recipes. For example, the action building a Debian package will explicitly refuse to run on a project not yet checked-out.
  • Aurelien first paired with Pierre-Yves to improve some views and the consistency of the database schema, then he worked on a dashboard displaying various indicators useful to the version publishing process.
  • Pierre-Yves spent some time improving the ability of Narval to recover on errors and to display meaningful logs about them.
  • Alexandre and Charles finished the re-implementation of the full python recipe.They used options at the Narval level to run test suite with the coverage enabled and re-enabled the coverage checker to process the result, discovering some problems in Narval's engine on the way...
  • Celso finished Spanish translation of Cubicweb's core and started to work on a new css theme
  • Sylvain helped several groups along the day and reviewed patches from them.

Summer CubicWeb/Narval Sprint - Day 3

2010/08/13

CubicWeb/Narval Sprint is going on !

The third day of our sprint focused on the following points:

  • Pierre-Yves worked to prevent duplicate test executions (eg running several time the same test with the same version configuration),
  • Celso has terminated the spanish translation of CubicWeb. He's now working on various cubes translation,
  • Stéphanie and Alain spent some time on the narval bot view. They also modified ProjectEnvironement's attributes in order to use similar information available on the vcsfile repository, hence simplifying the configuration (more to do on this!),
  • Julien worked on the debian package recipe,
  • Katia and Aurélien worked on recipe security (using CWPermission),
  • Alexandre and Charles produced a first template of a full test recipe using pyunit and pycoverage,
  • Finally, our captain, Sylvain, is at the helm !

We'll hopefuly be able to present a functionnal demo at the end of the week.

Narval/Cubicweb left off !


Summer CubicWeb/Narval Sprint - Day 2

2010/08/11 by Katia Saurfelt

During the second day of our Summer CubicWeb/Narval Sprint, several tasks started on the first day were completed and new tasks started:

  • Charles, Alexandre and Julien finished writing the "copy" and "move" Narval actions, and then started transforming existing apycot checkers into Narval actions.
  • Pierre-Yves managed to improve Narval reports with more explicit and relevant content.
  • Stéphanie and Alain finished the bot status view as well as the recipe graph view.
  • Katia and Aurélien finished writing the new mercurial cache solution for vcsfile and started improving the security of Narval recipes (i.e. who can start which recipe).
  • Celso kept on his life-long work of translating CubicWeb to Spanish.
  • Sylvain wrote some Narval views, improved Narval execution logs handling and kept on reviewing patches and helping various people...

Summer CubicWeb/Narval Sprint - Day 1

2010/08/10 by Sylvain Thenault

We started this first day by several presentations by Sylvain about Logilab's current development process workflow, and compared it to what it should be after the sprint. Sylvain also introduced Narval.

We then set up a dev environment on everyone's computer: a working forge with a local Narval agent that can be used for tests during the week.

Regarding more concrete tasks:

  • Charles and Alexandre started writing some basic Narval actions such as move, to move a file from a place to another, and had to grasp narval's concepts on the way.
  • Pierre-Yves dug into the code to understand how exceptions are propagated in the Narval engine, his goal was to get better reports.
  • Stéphanie and Alain worked on a nice bot status view.
  • Katia, Aurélien studied the new mercurial cache solution for vcsfile
  • Julien started some piece of documentation.
  • Celso, our Mexican friend, discovered some new features of recent cubicweb releases and setup his environment to later work on Spanish translation, CSS, etc.
  • Sylvain came with a basically working narval implementation on top of cubicweb, and spent the day helping various people...

Summer CubicWeb/Narval Sprint

2010/08/10 by Sylvain Thenault

Although this week is normally the regular annual holidays here at Logilab, some of us will sprint in Paris exceptionally.

Focus

We're starting this week with an exciting goal: integrating all our release process into our continuous integration suite (through the apycot cube). Including Debian repository management, pypi registration, etc...

The hot stuff to achieve this is the third resurrection of Narval, the project Logilab was originaly based on, but this time it is built on top of CubicWeb framework. Narval will be used to rewrite some parts of apycot, in order to make it more flexible and powerful.

It is not just a refactoring or a simple upgrade! We hope to automate common tasks, simplify maintenance, and thus enhance release quality, but also gain a lot of functionality in near future.

Sprint roadmap

  • merge Apycotbot process manager into a new Narval incarnation, and rewrite it as Narval actions and recipes
  • improve vcsfile cube with a new cache system for mercurial
  • define Logilab's release process as new Narval recipes, triggered by actions such as adding release tag into the source repository

More detailed stuff will come with the sprint reports that we'll try to issue each day.

Information

This sprint is taking place in Logilab's offices in Paris from Monday the 9th to the 13th of August 2010.


HOWTO change the value of a variable in all-in-one.conf with a migration script

2010/08/03

Here is a sample migration script (see also the cubicweb documentation on that topic) which changes the variable 'sender-addr'. There is an additional twist in that the variable is only updated if the instance is configured with a known value for that variable.

wrong_addr = 'cubicweb@loiglab.fr' # known wrong address
fixed_addr = 'cubicweb@logilab.fr'
configured_addr = config.get('sender-addr')
# check that the address has not been hand fixed by a sysadmin
if configured_addr == wrong_addr:
    config['sender-addr'] = fixed-addr
    config.save()

This is very useful in cases such as:

  • automatically changing the value of a variable which used a default value set by cubicweb-ctl create
  • changing the configuration of an instance with limited intervention from the local sysadmin (because asking him to hand edit the config file is error prone): he just has to deploy the new release and run cubicweb-ctl upgrade
  • fixing issues caused by settings in the all-in-one.conf file (e.g. changing the value of max-post-length)