Hey Boris,

2012/8/18 Nagaev Boris <bnag...@gmail.com>:
> Starting with version 3.2.2, Wt::Dbo throws strange exception
> "circular dependency detected".
>
> 1. What is wrong with circular dependency in database? There are a lot
> of examples, when it is needed.

It seems that indeed we are being overly stringent.

> can to do to work around this exception is modifying Wt's source to
> remove it.

When removing the warning, you do not see any adverse effects?

> 4. Why circular dependency is a problem for Dbo objects in memory? I
> mean, what will Wt::Dbo do, if object A refers using dbo::ptr object
> B, while object B refers A with dbo::ptr. And no other ptr refers
> these objects. Does it mean memory leak (at least, in current
> dbo::Session)? Can dbo unload object with non-null reference-count?

Yes that is something that indeed will lead to a memory leak and is a
situation that we wanted to warn against.

> I think, Wt::Dbo should behave as memory manager: longly unused
> objects go to swap (i.e. to database, ptr.flush() && ptr.purge()).
> Because of lazy loading, this can be done. In this case circular
> dependency would not be a problem. Could you implement it, please?

The main problem is that we currently depend on reference counting.
What you are really suggesting is that we also do a 'mark' and 'sweep'
garbage collection. I've never considered this before, but indeed, it
might make sense since Wt::Dbo indeed has a centralized knowledge on
all objects, and it has everything in place to implement the
traversal. In that case we can simply break the cycle as the
corrective action, which should normally lead to a normal (but
post-poned) action.

I'm not sure how this will work in practice (how to configure this
'mark&sweep'), but I suspect that in reality most sessions will only
have a very low number of objects that are being kept around during
user think-time and thus there is indeed opportunity to do this every
so many requests.

I've marked this as a feature request: http://redmine.emweb.be/issues/1435

Regards,
koen

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to