Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  Thread safety? In Erlang?

ketralnis
Posted: Fri Dec 14, 2007 1:33 am Reply with quote
User Joined: 20 Jul 2007 Posts: 151 Location: San Francisco, CA
I never thought I'd have to ask about thread safety in an Erlang
library, but here goes. If I have two processes using erlydb at the
same time with the psql driver, about 50% of my erlydb calls fail,
with errors that vary widely. Here's one:

ERROR erlang code crashed:
File: appmod:0
Reason: {badarg,[{erlydb_base,get,2},
{erlyweb,ewc,2},
{erlyweb,render_subcomponent,2},
{erlyweb,'-ewc/2-lc$^0/1-0-',2},
{erlyweb,'-ewc/2-lc$^0/1-0-',2},
{erlyweb,ewc,2},
{erlyweb,render_subcomponent,2},
{erlyweb,'-ewc/2-lc$^0/1-0-',2}]}
Req: {http_request,'GET',{abs_path,"/"},{1,1}}

Here's another one:

{ok,
{sql_error,
"25P02",
"Rexec_simple_query L928 Fpostgres.c Mcurrent transaction is
aborted,
commands ignored until end of transaction block"}}

(Yes, that says 'ok'; it's a return value from an erlydb 'find'
function that *failed* that says 'ok' rather than throwing an
exception.) For both of those, I can re-run the line of code and it
works. Or doesn't. It depends. There are others, but none that I can
reproduce in just a few seconds, which is maybe worse.

Unless someone has a quick solution, I'm going to have to assume that
this is indicative of a major design issue and start re-writing this
driver. Or reconsidering erlydb at all. That's a serious architectural
flaw. Are you *sure* you want to re-invent the database abstraction
wheel?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message AIM Address
Guest
Posted: Fri Dec 14, 2007 2:08 am Reply with quote
Guest
On Dec 13, 2007 5:32 PM, David King <dking@ketralnis.com> wrote:
>
> I never thought I'd have to ask about thread safety in an Erlang
> library, but here goes. If I have two processes using erlydb at the
> same time with the psql driver, about 50% of my erlydb calls fail,
> with errors that vary widely. Here's one:
>
> ERROR erlang code crashed:
> File: appmod:0
> Reason: {badarg,[{erlydb_base,get,2},
> {erlyweb,ewc,2},
> {erlyweb,render_subcomponent,2},
> {erlyweb,'-ewc/2-lc$^0/1-0-',2},
> {erlyweb,'-ewc/2-lc$^0/1-0-',2},
> {erlyweb,ewc,2},
> {erlyweb,render_subcomponent,2},
> {erlyweb,'-ewc/2-lc$^0/1-0-',2}]}
> Req: {http_request,'GET',{abs_path,"/"},{1,1}}

I've seen this error but only when I've misused ErlyDB by passing in a
tuple of the wrong type to an ErlyDB function.

>
> Here's another one:
>
> {ok,
> {sql_error,
> "25P02",
> "Rexec_simple_query L928 Fpostgres.c Mcurrent transaction is
> aborted,
> commands ignored until end of transaction block"}}
>
> (Yes, that says 'ok'; it's a return value from an erlydb 'find'
> function that *failed* that says 'ok' rather than throwing an
> exception.) For both of those, I can re-run the line of code and it
> works. Or doesn't. It depends. There are others, but none that I can
> reproduce in just a few seconds, which is maybe worse.
>
> Unless someone has a quick solution, I'm going to have to assume that
> this is indicative of a major design issue and start re-writing this
> driver. Or reconsidering erlydb at all. That's a serious architectural
> flaw. Are you *sure* you want to re-invent the database abstraction
> wheel?

The Postgres driver was created by Erlang Consulting and Roberto
Saccon did some modifications and also wrote the ErlyDB adapter for
it. Since I haven't used it, I can't vouch for its quality. From the
issues you're experiencing, it looks like the driver needs some
fixing. I doubt it's a major design issue -- it's probably a couple of
good ol' bugs.

ErlyDB isn't about re-inventing the DB abstraction wheel -- the wheel
simply hasn't existed for Erlang before ErlyDB.. ErlyDB is
conceptually very simple, by the way. It just generates a bunch of
functions that know how to output SQL based on their parameters. The
problems are from the Postgres driver. I use ErlyDB with MySQL a lot
in Vimagi and have never encountered this kind of bug.

>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum