drasticactions / FishyFlip

Fishyflip - a .NET ATProtocol/Bluesky Library
MIT License
33 stars 3 forks source link

Exception on running firehose sample #10

Open TimBurga opened 8 months ago

TimBurga commented 8 months ago

Unfortunately it looks like it may be a race condition in the 3rd party library

System.ArgumentException: The IPFS codec name 'codec-1' is already defined.
   at Ipfs.Registry.Codec.Register(String name, Int32 code)
   at Ipfs.MultiCodec.ReadMultiCodec(Stream stream)
   at Ipfs.Cid.Read(Byte[] buffer)
   at FishyFlip.Tools.Cbor.CborExtensions.ToCid(CBORObject obj)
drasticactions commented 8 months ago

It's known, you can ignore it. It doesn't break the underlying code.

drasticactions commented 8 months ago

For now, we can handle it by outputting the error to the logger so the rest of the object can come through, and you can still act on the error by passing in an ILogger to the underlying Firehose class.

https://github.com/drasticactions/FishyFlip/commit/1c280a3736fc4091d1cc909d2d5a60647d54059c

Since Cid is nullable, your code should already be handling cases where it could be null. I would need to look further if there's something I'm missing by not registering the types in advance, or if it is a race condition in the Ipfs library.