John Deal | 15 Jan 2012 13:11
Picon
Favicon

MySQL Multi-threaded

Hello All,

I have continued to work on the MySQL multi-threaded issue but still no resolution.  It works fine single-threaded (meaning  setting the number of server threads to 1 in mira.conf).

I am convinced it has nothing to do with using prepared statements.  This leaves either MySQL is not being initialized properly for multi-threaded operation or there are improperly shared variables between threads.  The MySQL initialization is fairly simple and since we link the thread-safe library, no different than than single-threaded operation except for the added check that MySQL is thread-safe (which it comes back positive).

Each sever thread has its own instance of the DbMySqlDirectory (which is derived from DbDirectory) and each DbMySqlDirectory creates its own connection to the MySQL server so each thread has its own DB connection.  The only shared variable is a first-time initialization flag which is controlled by an exclusive lock (in fact, the lock is not needed since this DbDirectory constructor is only currently called by main()).  All other code uses local or instance-level variables.

I have added extensive debug code to my local version of mira_server.  It displays the beginning and ending of DbMySqlDirectory methods indicating thread ID and instance address.  This gives me a view into what threads are active and what DbMySqlDirectory instance they are using.

The scenario which constantly causes the server to crash is as follows:

3 users with 2 workplaces where each workplace has 2 members.
Login of one user (sometimes it takes two logins).

The server segfaults when DbMySqlDirectory.find_workplace(ID) is active with one thread and multiple DbMySqlDirectory.find_user(ID) are taking place.  This is when the client has received information on one workplace the user belongs, issues commends to find out user details of all members of the workplace, and issues a command to get information on the second workplace the user belongs to.  This results in one thread doing the find_workplace() and other threads doing find_user().  The crash happens on a mysql_stmt_execute() command which performs the actual query on the server. The stack is trashed so I don't get a stack trace.  I suspect the bind variables used in the query are trashed either on the mira_server side or the MySQL server side (these bind variables contain pointer to where to put the resulting queried data).  All queries involved are read-only (select).

I am not sure what to do at this point.  I am out of ideas on resolving this issue.  I could convert DbMySqlDirectory to use non-prepared queries or to use the C++ MySQL connector and see if that makes a difference.  Both would require a substantial amount of rework and testing.  I would prefer trying the C++ connector.  I am not convinced that either would solve the problem but I am willing to do it.

I don't want to hold up the project any longer because of this issue.  I propose that I fix some issues I found during my investigation and submit those to the dbBackend branch and we document that a MySQL-configured server must run with one client thread until I fix the problem.

If anyone would like to help me on this issue that would be great.

Thanks,

John




------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Mira-development mailing list
Mira-development@...
https://lists.sourceforge.net/lists/listinfo/mira-development
John Deal | 29 Dec 2011 03:13
Picon
Favicon

MySQL Directory Not Working Multi-Threaded

Hello all,

I am still not able to get the MySQL directory to work multi-threaded.  I have been working on this off and on that last month and several days the last few weeks with no luck.  It seems to work fine single-threaded.  I have verified each thread has its own DbMySqlDirectory each with a unique connection to the database.

I have not received any responses from my post on the MySQL C API forum and the response on the #mysql IRC was "C and C++ are complicated".

I do have some simple sample code from the MySQL community documentation that does run multi-threaded.  Interesting the original code used locks to provide exclusive access to the MySQL database which sort-of removes most of the benefits of running MySQL multi-threaded.  I removed the locks and it seems to work fine.  However this sample code does not use prepared statements.  I am not sure if that makes any difference.

I thought I would relay my status on the DB Backend.  If desired, I could check-in a version of the Directory that essentially serializes MySQL access even in multi-threaded environments to use until the multi-threading issue gets worked out.  Getting the MySQL part of the Directory to properly work multi-threaded may take awhile.  What do you think?

Thanks,

John
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Mira-development mailing list
Mira-development@...
https://lists.sourceforge.net/lists/listinfo/mira-development
noreply | 11 Dec 2011 20:57

[Branch ~mira-dev/mira/dbBackEnd] Rev 237: Fixed various joining workplaces and subscription issues. Reduced number of mysql_execute() stac...

------------------------------------------------------------
revno: 237
committer: John Deal <bassdeal@...>
branch nick: dbBackEnd
timestamp: Sun 2011-12-11 14:55:19 -0500
message:
  Fixed various joining workplaces and subscription issues.  Reduced number of mysql_execute() stack
trash workarounds to one.  Deleted various commented debug code.
added:
  mira-server/conf/mira.conf.mysql
modified:
  mira-server/src/directory/db/DbDirectory.cpp
  mira-server/src/directory/db/mysql/DbMySqlDirectory.cpp

--
lp:~mira-dev/mira/dbBackEnd
https://code.launchpad.net/~mira-dev/mira/dbBackEnd

You are subscribed to branch lp:~mira-dev/mira/dbBackEnd.
To unsubscribe from this branch go to https://code.launchpad.net/~mira-dev/mira/dbBackEnd/+edit-subscription
Attachment (revision-diff.txt): text/x-diff, 13 KiB
------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Mira-development mailing list
Mira-development@...
https://lists.sourceforge.net/lists/listinfo/mira-development
noreply | 15 Nov 2011 03:21

[Branch ~mira-dev/mira/dbBackEnd] Rev 236: Added directory_sqlite namespace to parallel directory_mysql namespace. Upgraded SQLite code from...

------------------------------------------------------------
revno: 236
committer: John Deal <bassdeal@...>
branch nick: dbBackEnd
timestamp: Mon 2011-11-14 21:19:46 -0500
message:
  Added directory_sqlite namespace to parallel directory_mysql namespace. Upgraded SQLite code from
3.7.6.2 to 3.7.9 as recommened by SQLite project.  Removed unneeded sqlite3ext.h.
removed:
  mira-server/include/directory/db/sqlite/sqlite3ext.h
modified:
  mira-server/CMakeLists.txt
  mira-server/include/directory/db/sqlite/DbSqliteDirectory.h
  mira-server/include/directory/db/sqlite/sqlite3.h
  mira-server/src/directory/db/DbDirectory.cpp
  mira-server/src/directory/db/sqlite/DbSqliteDirectory.cpp
  mira-server/src/directory/db/sqlite/sqlite3.c
  mira-server/src/main.cpp
The size of the diff (27161 lines) is larger than your specified limit of 5000 lines

--
lp:~mira-dev/mira/dbBackEnd
https://code.launchpad.net/~mira-dev/mira/dbBackEnd

You are subscribed to branch lp:~mira-dev/mira/dbBackEnd.
To unsubscribe from this branch go to https://code.launchpad.net/~mira-dev/mira/dbBackEnd/+edit-subscription

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
Max Bossino | 8 Oct 2011 16:04

Developer Meeting on 09 Oct 2011

Dear all, 

A developer meeting has been scheduled for Sunday 09 October 2011 at 13:00 UTC. 

You are kindly invited to join this meeting, which will be held on #mira on FreeNode. The topic is: General 

The meeting agenda can be found at:
http://miragroupware.org/wiki/doku.php/development/communication/agendas/111009_meeting 

An up-to-date list of who will be attending can be found on the Mira Groupware Meeting Planner:
http://miragroupware.org/meetings/ 
The core developers have been asked to respond to this invitation through the Planner. If you have not
received an invitation, please respond to this mailing list thread to let us know if you can attend. 

I look forward to speaking to you at the meeting! 

Best regards, 

Max Bossino 
Project Manager 
http://miragroupware.org 

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
noreply | 2 Oct 2011 18:00

[Branch ~mira-dev/mira/dbBackEnd] Rev 235: Corrected loading of default MySQL DB password. Improved multi-threaded DB load tests. Improved...

------------------------------------------------------------
revno: 235
committer: John Deal <bassdeal@...>
branch nick: dbBackEnd
timestamp: Sun 2011-10-02 11:57:54 -0400
message:
  Corrected loading of default MySQL DB password.  Improved multi-threaded DB load tests.  Improved 1
configuration error message.  Removed 1 warning.  Minor stuff.
modified:
  mira-server/conf/mysqlInit.sql
  mira-server/src/ConfigParser.cpp
  mira-server/src/directory/db/DbDirectory.cpp
  mira-server/src/directory/db/mysql/DbMySqlDirectory.cpp
  mira-server/src/main.cpp

--
lp:~mira-dev/mira/dbBackEnd
https://code.launchpad.net/~mira-dev/mira/dbBackEnd

You are subscribed to branch lp:~mira-dev/mira/dbBackEnd.
To unsubscribe from this branch go to https://code.launchpad.net/~mira-dev/mira/dbBackEnd/+edit-subscription
Attachment (revision-diff.txt): text/x-diff, 9 KiB
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Mira-development mailing list
Mira-development@...
https://lists.sourceforge.net/lists/listinfo/mira-development
John Deal | 2 Oct 2011 18:07
Picon
Favicon

Bzr: No new revisions to push

Hello All,

I just did a commit of a few changes to the dbBackEnd branch.  The commit went well but when  did a bzr push I got the following:

-----------------------------------------
jdeal <at> GatwayUbuntu:mira-server$ bzr commit -m "Corrected loading of default MySQL DB password.  Improved multi-threaded DB load tests.  Improved 1 configuration error message.  Removed 1 warning.  Minor stuff."
Committing to: bzr+ssh://bazaar.launchpad.net/~mira-dev/mira/dbBackEnd/        
modified mira-server/conf/mysqlInit.sql                                        
modified mira-server/src/ConfigParser.cpp                                      
modified mira-server/src/main.cpp
modified mira-server/src/directory/db/DbDirectory.cpp
modified mira-server/src/directory/db/mysql/DbMySqlDirectory.cpp
Committed revision 235.                                                        
jdeal <at> GatwayUbuntu:mira-server$ bzr push
Using saved push location: bzr+ssh://bazaar.launchpad.net/~mira-dev/mira/dbBackEnd/
No new revisions to push.                                                      
jdeal <at> GatwayUbuntu:mira-server$
---------------------------------------

However, when I looked quickly in Launchpad, the changes seem to be there in revision 235.  The last revision was 09.04.11 (if I remember correctly) and it was revision 234.  Does anyone know what the "No new revisions to push" message means?

Thanks,

John

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Mira-development mailing list
Mira-development@...
https://lists.sourceforge.net/lists/listinfo/mira-development
John Deal | 25 Sep 2011 18:16
Picon
Favicon

Cmake and QT 4.7.4

Hello All,

I am trying to move my development to a different system (Ubuntu 9.10->Ubuntu 10.04) and running into difficulties.

I setup QT and CMake and all the other packages.  I bzr co all the sources.  I am able to build the server fine.  However, I am getting the following errors trying to build the client:

jdeal <at> GatwayUbuntu:mira-client$ cmake ./
** Mira found Boost version 104400
CMake Error at /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE
  QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR
  QT_QTCORE_LIBRARY)
Call Stack (most recent call first):
  /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-2.8/Modules/FindQt4.cmake:1162 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  Dependencies.cmake.in:21 (FIND_PACKAGE)
  CMakeLists.txt:5 (INCLUDE)


-- Configuring incomplete, errors occurred!
jdeal <at> GatwayUbuntu:mira-client$

I am using the open-source QT version 4.7.4 which is the current version.  I rebuilt/reinstalled QT and CMake but still get the same errors.  I searched through the configuration files but could not find any fixed version specification.  I am using CMake 2.8.5.

If anyone has any ideas why this is happening please enlighten me.

Thanks,

John
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Mira-development mailing list
Mira-development@...
https://lists.sourceforge.net/lists/listinfo/mira-development
Max Bossino | 21 Sep 2011 01:20

Summary of 18 Sep 2011 Meeting

Hi all, 

Sunday's meeting was attended by John, Shilpa, Zied and myself. A transcript of the meeting can be found
here: 
http://miragroupware.org/wiki/doku.php/development/communication/archives/110918_meeting 

This meeting had a brief agenda, which can be found here: 
http://miragroupware.org/wiki/doku.php/development/communication/agendas/110918_meeting 

We spoke first about meeting times. Following the mailing list thread on the same topic, we have decided to
hold the next meeting (on Sunday 2nd October) at 13:00 UTC. This is the time that proves most convenient for
all of us. At least, John, Shilpa, Zied and I all said that the time was suitable on a Sunday. If you find that
this time is inconvenient for you in the long-run, please reply to the other thread regarding meeting
times with your own preferences and we will do our best to accommodate everyone in the future.

John has made excellent progress with his MySQL and SQLite database interfaces for the Directory layer. He
has stabliised the MySQL interface, and has moved code which is common to both interfaces up to
DbDirectory (above DbSqliteDirectory and DbMySqlDirectory). He has also removed a lot of archaic,
commented out code. Finally, as you will have seen on the mailing list, he has prepared detailed
instructions on how to configure the Server to use a database backend to store Directory data.

The blueprint for the database backend to the Directory layer that is found on the wiki is now out of date,
because I prepared it many years ago. John intends to update it to correct the record structures detailed therein.

John also mentioned that he would like to merge his branch into our main branch, trunk. Given that his code is
feature-complete, it just needs to be bug tested before it is merged into trunk. I am going to do some
testing this weekend. If anyone else can join in with the testing, please do - the more usage, the more
likely it is that we might spot a bug at this stage. We will follow the procedure detailed here to merge
John's branch: http://miragroupware.org/wiki/doku.php/development/workflow and here: https://help.launchpad.net/Code/Review

Shilpa has made very good progress on the Network layer. She has had to change almost all of the network
protocol in order to implement Google Protocol Buffers. This will allow binary data transfer between
Client and Server, because the messages are no longer parsed according to a special splitting character
sequence. Instead, Shilpa's protocol first sends the length of the message, and then the message. Shilpa
has already converted the Login, New User, and Join Group messages. Now that most of the groundwork is
done, she will continue to convert the other messages over the next few weeks. 
Shilpa has been developing this on a local Bazaar branch. She would prefer to get the code stable before
pushing it to Launchpad, but I suggested that she should push it to Launchpad and keep pushing new commits
regularly in order to evade the conflicts that arose the last time that a major change was pushed in one go.
Shilpa agreed to try to push her code to Launchpad the next time that she works on it.

Zied has moved to a new job, and is now eager to contribute to Mira. (Welcome to the team, Zied!) He said he was
interested in splitting Shilpa's task and working on converting some of the network messages to use GPB.
Shilpa said that this might be difficult because some messages rely on other messages (such as the Login
message, which also required changes to the List Workplace and Status messages), so it would be difficult
to draw a line down the middle and split the messages between them. However, Shilpa said that she would look
at the code and see if it would be possible to split the task between them. She will then email her conclusion
to the mailing list. If it turns out that splitting the task would be too difficult, there are plenty of
tasks remaining for Mira v0.2 to choose from: 
 http://miragroupware.org/wiki/doku.php/development/roadmap/outstanding

John would also like to change a few of the messages to make the database interfaces work more efficiently.
For example, one change would involve splitting the message to update a Workplace into separate add
subscription and delete subscription messages. He intends to make these changes once his branch has been
merged into trunk.

Finally, John mentioned that the links on the wiki to download the Qt libraries were broken. I have now fixed these.

Best regards, 

Max Bossino
Project Manager
http://miragroupware.org 
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
Max Bossino | 16 Sep 2011 17:27

Meeting times

Hi all,

As you will have read, I have arranged a meeting for this Sunday, 18th 
September, at 22:00 UTC. I hope that you can join it!

However, I know that a few of us find the current meeting time 
inconvenient. In order to fix this, I would like to conduct a quick, 
simple survey to see what time would be convenient for the majority of 
us. Please copy and paste the following 'table' and put a cross next to 
the meetign starting times that are fine for you on a normal Sunday:

13:00 UTC x
14:00 UTC x
15:00 UTC x
16:00 UTC x
17:00 UTC x
18:00 UTC x
19:00 UTC x
20:00 UTC x
21:00 UTC x
22:00 UTC x
23:00 UTC x

(I can attend any of those times.)

Once everyone has replied, we can put it all together and work out 
which time is best.

Thank you!

Best regards,

Max Bossino
Project Manager
http://miragroupware.org

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
Max Bossino | 16 Sep 2011 17:20

Developer Meeting on 18 Sep 2011

Dear all, 

A developer meeting has been scheduled for Sunday 18 September 2011 at 22:00 UTC. 

You are kindly invited to join this meeting, which will be held on #mira on FreeNode. The topic is: General
Update 

The meeting agenda can be found at:
http://miragroupware.org/wiki/doku.php/development/communication/agendas/110918_meeting 

An up-to-date list of who will be attending can be found on the Mira Groupware Meeting Planner:
http://miragroupware.org/meetings/ 
The core developers have been asked to respond to this invitation through the Planner. If you have not
received an invitation, please respond to this mailing list thread to let us know if you can attend. 

I look forward to speaking to you at the meeting! 

Best regards, 

Max Bossino 
Project Manager 
http://miragroupware.org 

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2

Gmane