Hello Alan,

Thanks.  There seems to be a thread pool of which the number is set at startup 
with each thread making independent calls to the Directory.  It is my 
understanding all threads share the same instance of the Directory.  Is that 
correct?

I seem to have "fixed" my memory corruption problem.  At least I have not been 
able to reproduce it.  It came at a cost.  My original implementation provided 
for many readers.  SQLite can handle that but the issue would be the prepared 
statements.  One reader could reset a statement used by another reader since 
there is only one set per instance.  This is where I suspected my memory 
corruption was.  We could not use prepared statements but this would cause 
significant overhead.

To "fix" this I set a write lock on all transactions.  This seemed to work but 
it makes the SQLite Directory essentially single-threaded.  I could now setup 
SQLite without any locking which would save significant processing overhead but 
still not a great situation.

Thinking about this for a bit, I could setup a DB connection pool with each 
connection being an instance of DbSqliteDirectory, using the number thread 
configuration parameter.  A call to the SQLite Directory would grab a reader or 
writer lock depending on the call requirements.  One getting the lock, it would 
be allocated one of the connections. Since each instance has only one thread 
running on it at once, it has its own set of prepared statements.  This would 
also allow multiple readers if there are not any writers.  A writer would need 
exclusive access.  This could be implemented with each server thread obtaining 
a Directory handle at startup.  The current plaintext Directory could just 
ignore these calls.

Anyway, still working on this but I want to get it to work with multiple 
readers.

Later,

John

 

--- On Fri, 3/25/11, Alan Alvarez <aalva...@aliensoft.net> wrote:

From: Alan Alvarez <aalva...@aliensoft.net>
Subject: Re: [Mira-development] SQLite Status
To: "Mira Development Mailing List" <mira-development@lists.sourceforge.net>
Date: Friday, March 25, 2011, 10:59 AM

Hello,
    I'm sorry I took so long to respond. The whole system is multi-threaded in 
both the client and the server. Although there are some locking structures in 
place, we need to investigate how to further make the framework more 
thread-safe. I have run into a few race conditions in the past, and I think 
there are a few that still exist.

regards,

Alan Alvarez



On Tue, Mar 22, 2011 at 4:53 AM, Max Bossino <m...@miragroupware.org> wrote:

Hi John,



Thank you for letting us know. I would be happy to test it, now that my exams 
are over and I've got (some) time on my hands. Would you please publish the 
code that you have to Launchpad or, alternatively, package it and upload it to 
a site like box.net so that I may download it and try it out? I might be able 
to reproduce the problem (or not).




Unfortunately, I cannot help with your final question! Alan, do you know if the 
Directory is single-threaded?



Regards,



Max



On 19 Mar 2011, at 18:04, John Deal <bassd...@yahoo.com> wrote:



> Hello All,

>

> I have not resolved the SQLite issue I have after many many hours of working 
> on it.  It seems to be a memory corruption error but I am blind in the SQLite 
> library.  I have been able to repeat it more often but it does not happen all 
> the time.  For awhile the code was working for fairly long periods of time 
> without failure.  I don't know what the difference is.


>

> My next move is to download the SQLite source code, compile it, and static 
> link it.  At least there the debugger will have the source code and symbols 
> available.  I have gone through some updates on my development system but I 
> doubt that is the issue.


>

> I have to put this down for a bit since my other work has backed up quite a 
> bit.  I will try to get to it again this weekend but I can not be for sure 
> that will happen.

>

> I have a question unrelated to this issue that most likely Alan knows but if 
> anyone else knows please enlighten me.  Is the Directory single-threaded?  In 
> other words, when a message is received it is allowed to complete before 
> another message process is started?


>

> Thanks,

>

> John

>

>

>

>

>

> ------------------------------------------------------------------------------

> Colocation vs. Managed Hosting

> A question and answer guide to determining the best fit

> for your organization - today and in the future.

> http://p.sf.net/sfu/internap-sfd2d

> _______________________________________________

> Mira-development mailing list

> Mira-development@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/mira-development



------------------------------------------------------------------------------

Enable your software for Intel(R) Active Management Technology to meet the

growing manageability and security demands of your customers. Businesses

are taking advantage of Intel(R) vPro (TM) technology - will your software

be a part of the solution? Download the Intel(R) Manageability Checker

today! http://p.sf.net/sfu/intel-dev2devmar

_______________________________________________

Mira-development mailing list

Mira-development@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/mira-development




-----Inline Attachment Follows-----

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
-----Inline Attachment Follows-----

_______________________________________________
Mira-development mailing list
Mira-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mira-development



      
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Mira-development mailing list
Mira-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mira-development

Reply via email to