none
Syncagent.synchronize blocks my application

    Question

  • Question
    You cannot vote on your own post
    0

    Hi all,

    I finally managed to synchronize my SqlCompact DB on my Windows CE 6.0 device with SQL server as in http://msdn.microsoft.com/en-us/library/dd938879.aspx.

    My application is receiving data from internal microcontroller over RS232 every second. After that i do some calculations and insert data into DB on my device. The problem is when I call syncagent.synchronize (function is on a separate thread with lowest priority selected) another thread that reads COM port doesn't read any data from serial port. It is checking the serial buffer buffer but there is nothing in there.

    Could it be that whole synchronize function calls something outside my application which is blocking the system functions which are controlling serial port?

    Could I somehow set priority to system functions that syncagent calls, or the system function that is controlling serial com buffer?


    And I am not even synchronizing a lot (aprox. 60 rows 300 bytes each)

    Hope someone has a solution to this.

    Thanks,

    Greg

    Tuesday, August 27, 2013 8:40 AM

All replies

  • Am almost certain there's nothing closely related to serial ports in the database sync of Sync Fx. How are you testing to determine that there's no data coming in? Are you checking if data from the port got added while you're doing a sync?


    Tuesday, August 27, 2013 1:56 PM
    Moderator
  • Hi,

    yes I have two threads in my application in first one I check serialport.bytestoread every 50ms (thread.sleep(50)), and in second I call syncagent.synchronize. I measure time how long sync takes and its just above 4 seconds. In the mean time 4 packets should arrive to serialport (completely independent micro controller is sending this data every second), but every time there is a sync in progress the serialport.bytestoread is empty all the time. I know that the thread that reads serialport is executed because I put a counter in the thread which I reset when I start the sync and stop the counter when the sync is finished and it is around 80 (80*50ms = 4s).

    I have no idea what else could it be. because if the sync is not in progress serialport is filled with data. The problem doesn't occur every time the sync is in progress but it happens. And the counter from thread reading it is always around 80 so the port is being checked.

    Best regards,

    Greg

    Wednesday, August 28, 2013 5:52 AM
  • It's been quite a while since I posted this. Is there really no idea what could be the problem.

    In the mean time I created new project which does nothing else except reads serial port (incase some other process in my application would be creating problems),  inserts data into table, and tries to sync it. But same problem occurs. While syncing, sometimes happens and there is no data in buffer.

    I am stuck here. Any help is very appreciated.

    Best regards,

    Grega

    Monday, September 09, 2013 11:47 AM
  • Why not split into 2 apps, on for logging serial input, and one for sync process?

    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

    Friday, October 04, 2013 12:28 PM
  • I will try this asap and report if it will be successful.
    Wednesday, October 16, 2013 12:56 PM
  • I created separate console application, and the error still occurs. I am not sure if I can solve this pro grammatically I guess Windows ce 6.0 are not made to handle this kind of load. My next try will be to use stronger computer board, and trying out Win EC 7.

    If any other suggestion come to mind please do share.

    Best regards.

    Thursday, October 17, 2013 12:51 PM