nofxx / georuby

This is intended as a holder for geometric data. The data model roughly follows the OGC.
MIT License
245 stars 55 forks source link

GeoRuby::SimpleFeatures::EWKBFormatError errors #55

Open Aryk opened 3 years ago

Aryk commented 3 years ago

When my model refreshes, I'm getting this error sometimes:

Screen Shot 2021-01-16 at 8 12 33 PM
      def read_point
        i = @position
        @position += 16
        fail EWKBFormatError.new('Truncated data') if @ewkb.length < @position
        @ewkb.unpack("@#{i}#{@double_mark}#{@double_mark}@*")
      end

I'm getting this in my production and I also get it in my test cases intermittently. My testcases are threaded which is why I thought they were happening.

But... they are also happening on production which is not using threading and it is just normal Rails / Puma. It seems like there is some kind of race condition being hit when the database records are being refresh.

I'm using Sequel orm which might be the source, but I don't think that is causing it.

Can someone give me some insight why this might be happening intermittently?

Aryk commented 3 years ago

Nevermind, the other library I was using wasn't threadsafe:

https://github.com/bsears/sequel-postgis-georuby/pull/1

This PR will fix it for those that use Sequel