# Ruby EE: Problem with BigDecimal

**URL:** <https://www.ruby-forum.com/t/ruby-ee-problem-with-bigdecimal/159296>\
**Category:** Rails\
**Created:** [February 3, 2009, 9:15am UTC](https://www.ruby-forum.com/t/ruby-ee-problem-with-bigdecimal/159296 "2009-02-03T09:15:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuktuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tuktuk](https://www.ruby-forum.com/u/tuktuk)\
**Post date:** [February 3, 2009, 9:15am UTC](https://www.ruby-forum.com/t/ruby-ee-problem-with-bigdecimal/159296/1 "2009-02-03T09:15:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tuktuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tuktuk](https://www.ruby-forum.com/u/tuktuk)\
**Post date:** [February 3, 2009, 10:14am UTC](https://www.ruby-forum.com/t/ruby-ee-problem-with-bigdecimal/159296/2 "2009-02-03T10:14:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tuktuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tuktuk](https://www.ruby-forum.com/u/tuktuk)\
**Post date:** [February 6, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/ruby-ee-problem-with-bigdecimal/159296/3 "2009-02-06T19:44:17Z")

</div>

_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

---

<div class="post-metadata">

**Author:** ![tuktuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tuktuk](https://www.ruby-forum.com/u/tuktuk)\
**Post date:** [February 6, 2009, 9:54pm UTC](https://www.ruby-forum.com/t/ruby-ee-problem-with-bigdecimal/159296/4 "2009-02-06T21:54:32Z")

</div>

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](http://www.marnen.org)

---

<div class="post-metadata">

**Author:** ![tuktuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tuktuk](https://www.ruby-forum.com/u/tuktuk)\
**Post date:** [February 7, 2009, 4:10pm UTC](https://www.ruby-forum.com/t/ruby-ee-problem-with-bigdecimal/159296/5 "2009-02-07T16:10:15Z")

</div>

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 🙂

- Carsten
