Mailing List Archive

Re: Possible fix for deadlocks in database
Sorry, for applying it as you would easily see.. you can copy it to inc
directory of Davical 1.1.4 and do a patch -p0 there...

El 3/4/16 a las 22:31, Egoitz Aurrekoetxea escribió:
> Good afternoon,
>
> As you know, when you are doing a massive upload to a collection, you
> end up by seeing in the logs the following errors :
>
> [Sat Apr 02 18:09:49.814518 2016] [:error] [pid 53742] [client
> 192.148.167.11:21670] davical: LOG:
> caldav.php/egoitz@ramattack.net/addresses/eb285f17-ac04-4d04-a826-f2d63b424a65.vcf:
> Query: QF: SQL error "40P01" - ERROR: deadlock detected DETALLE:
> Process 19727 waits for ShareLock on transaction 69330601; blocked by
> process 19728. Process 19728 waits for ExclusiveLock on tuple (0,29)
> of relation 1206940 of database 1206795; blocke
> .
> .
> .
> .
> .
> .
>
> [Sat Apr 02 18:09:49.818981 2016] [:error] [pid 53742] [client
> 192.148.167.11:21670] davical: LOG:
> caldav.php/egoitz@ramattack.net/addresses/eb285f17-ac04-4d04-a826-f2d63b424a65.vcf:
> Query: QF: SQL error "25P02" - ERROR: current transaction is aborted,
> commands ignored until end of transaction block"
>
> Basically this seems to be because perhaps Davical was designed having
> in mind all clients behave uploading or deleting for instance...
> elements but, one by one.... but nowadays... some clients
> work this way, and other ones, don't. You can easily adapt Sogo
> connector for behaving this proper way (and fix some other bug too by
> the way. You can download this patched by me version from
> https://www.saremail.com/docs/sogosarenet), but not for intance Apple
> contacts app (as it's not open source). In "El Capitan" it seems they
> have modified the CardDAV code by openning several
> simultaneous connectionsto the CardDAV server for faster uploads.
> Happens the same (although in CalDAV) with Lightning, Calendar app in
> Mac... and perhaps some other too....
>
> I have search in Google for a fix for this problem, but have not been
> able to find... just some ideas of Andrew McMillan saying he was
> thinking on writting something for fix the issue using memcached
> and so... After reading that, I stayed thinking in it... and think
> have found a simplier solution to this problem (well, at least,
> simplier than using memcached for me). I wanted to share the following
> patch
> for Davical 1.1.4 with you in order to know your opinion or
> contributing it. I know things could be perhaps better written but,
> this patch seems to work fine and could very easily be improved for
> working
> even slightly better (although have not been able to make it fail, all
> massive uploads and removals have succeeded) if needed.
>
> The patch is attached to this mail. Let me know your impressions about
> it :)
>
> Best regards,
>
>
>
> sarenet
> *Egoitz Aurrekoetxea*
> Departamento de sistemas
> 944 209 470
> Parque Tecnológico. Edificio 103
> 48170 Zamudio (Bizkaia)
> <mailto:egoitz@sarenet.es>egoitz@sarenet.es
> www.sarenet.es
>
> Antes de imprimir este correo electrónico piense si es necesario hacerlo.

--


sarenet
*Egoitz Aurrekoetxea*
Departamento de sistemas
944 209 470
Parque Tecnológico. Edificio 103
48170 Zamudio (Bizkaia)
egoitz@sarenet.es <mailto:egoitz@sarenet.es>
www.sarenet.es <http://www.sarenet.es>

Antes de imprimir este correo electrónico piense si es necesario hacerlo.
Re: [DAViCal-devel] Possible fix for deadlocks in database [ In reply to ]
Hi Egoitz,

would you mind translating the comments and messages to English? That
would make it easier to understand how it works when reviewing the patch.

cheers

Marten

Am 03.04.2016 um 22:35 schrieb Egoitz Aurrekoetxea:
> Sorry, for applying it as you would easily see.. you can copy it to
> inc directory of Davical 1.1.4 and do a patch -p0 there...
>
> El 3/4/16 a las 22:31, Egoitz Aurrekoetxea escribió:

--
Marten Gajda
CEO

dmfs GmbH
Schandauer Straße 34
01309 Dresden
GERMANY

phone: +49 177 4427167
email: marten@dmfs.org

Managing Director: Marten Gajda
Registered address: Dresden
Registered No.: AG Dresden HRB 34881
VAT Reg. No.: DE303248743


------------------------------------------------------------------------------
_______________________________________________
Davical-general mailing list
Davical-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/davical-general
Re: [DAViCal-devel] Possible fix for deadlocks in database [ In reply to ]
No problem on translating... but can explain what it does very easily....

If you try to do a PUT or a DELETE on my Davical server :

1 - It's checked if a file called as the own username in Davical, _*does
not exist* in a folder._ It creates it in this case, and with the PID of
the creator proccess inside the plain text file. This write down
of the PID is done with exclusive write lock.

2.- If a file called as the own username in Davical _*does exist* in a
folder_, it's content is read to see which PID created it (that pid is
written inside).

3.- If the pid of the reading proccess and written inside the pid _*are
the same*_... the proccess goes on...

4.- If the pid of the reading proccess and written inside the pid _*are
not the same*_... the proccess returns to point 2 and gets looped in the
2,3 and 4 steps till step 3 succeeds.

5.- _*When PID read from file and the own proccess's one are the same,
and all tasks (all code instructions pending) have been completed*_,
this token filename (whose name is the username) is removed from the
directory.

This way I avoided deadlocks....

That's how it works...

Bye Marten!!


El 4/4/16 a las 22:44, Marten Gajda escribió:
> Hi Egoitz,
>
> would you mind translating the comments and messages to English? That
> would make it easier to understand how it works when reviewing the patch.
>
> cheers
>
> Marten
>
> Am 03.04.2016 um 22:35 schrieb Egoitz Aurrekoetxea:
>> Sorry, for applying it as you would easily see.. you can copy it to
>> inc directory of Davical 1.1.4 and do a patch -p0 there...
>>
>> El 3/4/16 a las 22:31, Egoitz Aurrekoetxea escribió:

--


sarenet
*Egoitz Aurrekoetxea*
Departamento de sistemas
944 209 470
Parque Tecnológico. Edificio 103
48170 Zamudio (Bizkaia)
egoitz@sarenet.es <mailto:egoitz@sarenet.es>
www.sarenet.es <http://www.sarenet.es>

Antes de imprimir este correo electrónico piense si es necesario hacerlo.