Ruby EE: Problem with BigDecimal

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

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

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

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
[email protected]
http://www.marnen.org

Marnen Laibow-Koser wrote:

Two thoughts:

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

Yeah good idea.

  1. 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 :slight_smile:

  • Carsten