[Bioc-devel] cyclic dependency bug in Rdbi

Philip Lijnzaad p.lijnzaad at umcutrecht.nl
Mon Mar 21 11:23:19 CET 2011

Dear all, 

We use Rdbi often, and I keep coming across the rather inconvenient ''cyclic 
name space dependencies are not supported'' error. I decided to get to the 
bottom of this, and basiscally the problem is that Rdbi's .onLoad() function 
always tries to call dbReconnect(obj), even if the .onLoad() is being called
recursively. The latter happens if an R data file (e.g. .RData) contains an
object that has a class which is not yet loaded. Once the object is loaded, 
and then inspected, R loads the class definitions of that object. If the 
object's class depends on Rdbi, then it will of course load Rdbi. But in 
doing so, Rdbi's .onLoad() function will try to dbReconnect(obj). But obj 
cannot be accessed without loading all its class definitions, which leads to 
a recursive call to loadNamespace("Rdbi"), triggering the circular 

I see four solutions:

  (1) Never put 'Depends: Rdbi' in a class's DESCRIPTION. (not a solution, 

  (2) Force people to call library(Rdbi) before load()ing anything (no
      solution either; people forget that, then bother the local R guru's           

  (3) Don't call dbReconnect() in Rdbi's .onLoad() (see below)

  (4) Make Rdbi's  .onLoad() function a bit cleverer (this will take work)

I would really appreciate if this error would go away; many different people
seem to be bitten by it time and again (also many GRASS users seem to suffer
it).  I much prefer solution 3; I frankly think that blindly reconnecting a 
database connection from a saved object is plain wrong. After all, people 
often save an object to disk exactly because they don't want to have to 
connect to a database. In addition, I think it's hard to make this work 
robustly, as evidenced by the cyclic dependency error. (If needed I have a 
simple worked example reproducing the bug).

I may of course have overlooked something; please let me know if that is the 

I contacted the maintainer, but he hasn't responded yet, but the issue maybe 
requires wider consideration anyway. 

Philip Lijnzaad, PhD
Molecular Cancer Research
University Medical Center (UMC), Utrecht
Stratenum room 2.211 (on Tuesdays and Thursdays not in after 15.00)
MSN chat (*NOT* email): philip_lijnzaad at hotmail.com
P.O. Box 85060, 3508 AB Utrecht
(Universiteitsweg 100, 3584 CG Utrecht)
The Netherlands
tel: +31 (0)8875 68464
fax: +31 (0)8875 68479


De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht
ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct
te informeren door het bericht te retourneren. Het Universitair Medisch
Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W.
(Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij
de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197.

Denk s.v.p aan het milieu voor u deze e-mail afdrukt.


This message may contain confidential information and is...{{dropped:12}}

More information about the Bioc-devel mailing list