Forum: Ruby on Rails Ruby EE: Problem with BigDecimal

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Carsten G. (Guest)
on 2009-02-03 10:15
I have a strange problem with my setup of Passenger and Ruby Enterprise
Edition.

Sometimes the loading of BigDecimals from the database and session fails
(silently) and the variable containing the BigDecimal is just empty.

I cannot pinpoint where/when/how it happens, and it IS only periodic.

I am using the newest versions of both Passenger and REE - I have even
tried to run with latest commit of both: the problem still persist.

When running the same application under Passenge and "normal" Ruby the
problem is gone.

Has anyone else had this problem?

- Carsten
Carsten G. (Guest)
on 2009-02-03 11:14
Small discovery:

1) The problem begins after the application has run for a period of
time, e.g ½ hour.
2) If I do a "touch tmp/restart.txt" the problem disappears - only to
resurface again later

So I think something is "bottling up" inside the application. When it
happens, it concerns ALL BigDecimals extracted from a session or from
ActiveRecord, not just a single model.

- Carsten
Carsten G. (Guest)
on 2009-02-06 20:44
*sigh*

I found only one solution: I converted all my decimal fields in the DB
to varchar, and rewrote my code to make sure the value was converted
to BigDecimal before used in calculations.

- Carsten
Marnen L. (Guest)
on 2009-02-06 22:54
(Received via mailing list)
Carsten G. wrote:
> *sigh*
>
> I found only one solution: I converted all my decimal fields in the DB
> to varchar, and rewrote my code to make sure the value was converted
> to BigDecimal before used in calculations.
>

Two thoughts:

1. Use composed_of to make the process of String conversion completely
transparent.

2. Try a REE-specific forum for more help.

Good luck!

Best,
--
Marnen Laibow-Koser
removed_email_address@domain.invalid
http://www.marnen.org
Carsten G. (Guest)
on 2009-02-07 17:10
Marnen Laibow-Koser wrote:

> Two thoughts:
>
> 1. Use composed_of to make the process of String conversion completely
> transparent.

Yeah good idea.

> 2. Try a REE-specific forum for more help.

Already did that - in the Passenger google group. Though I was in doubt
if this was a Rails/AR/MySQL adapter thing, so I took the liberty to
cross-post here. It's quite an annoying problem, and it concerns me,
that apparently I am the only one experiencing it.

> Good luck!

Thanks :-)

- Carsten
This topic is locked and can not be replied to.