[erlang-questions] strange badarith error

Anthony Shipman <>
Thu Jun 23 13:06:51 CEST 2011

Today I was getting this occasional error while stress-testing:

23-Jun-2011 18:24:20.290| ERROR fleetDevMgr: device 38: The process for the 
device has exited for reason: {badarith,                                                                           
[{fleetDevImpl,qualFromDevice, 2},                                                                            
{fleetDevImpl, handle_cast, 2},                                                                            
{asn1rt_ber_bin, cindex, 3}]}

where the code in qualFromDevice is

case streamUtils:computeSTEPQuality(Q, true) of
{ok, RSUp, RSDown, RSUpBad, _, Blurb} ->
     ?DEBUG("fleetDevImpl: ~s: quality ~s", [deviceName(), Blurb]),

      T1 = State#state.traffic,
      T2 = T1#voiceTrafficStats{frameErr = (if RSUp == 0 -> 0.0; true -> 
RSUpBad/RSUp end)},

          currTraffic = {RSUp, RSDown},   % totals since the beginning of the 
          traffic     = T2,
          trafficChg  = true
_ ->

The only arithmetic in here is the division RSUpBad/RSUp and they are 
definitely integers. The DEBUG line is definitely executed.

The code has been compiled with Hipe in R12B4
Erlang (BEAM) emulator version 5.6.4 [source] [async-threads:0] [hipe] 

Is it possible I've got bad machine code here?

Why might asn1rt_ber_bin be in the stack trace when it isn't involved in this 
code at all?

Anthony Shipman                    Mamas don't let your babies 
                   grow up to be outsourced.

More information about the erlang-questions mailing list