Skip to content

Networking v2 Extensions Networkipavailabilities cannot unmarshal into a *big.Int #2233

Closed

Description

@alexeymyltsev

If create big IPv6 subnet and try to collect information about available ips rise exception:
math/big: cannot unmarshal "4.722366482869645e+21" into a *big.Int

It happens because resopnse from networkipavailabilities.List() decoded to json and field "total_ips": 4722366482869645213694 decoded as total_ips:4.722366482869645e+21

allPagesNetworkIPAvailabilities, err := networkipavailabilities.List(client, networkipavailabilities.ListOpts{}).AllPages()
if err != nil {
  fmt.Println(err)
}

After that if we try to extract pages like that:

_, err = networkipavailabilities.ExtractNetworkIPAvailabilities(allPagesNetworkIPAvailabilities)
if err != nil {
  fmt.Println(err)
}

we will have exception
math/big: cannot unmarshal "4.722366482869645e+21" into a *big.Int

Activity

  1. rrraditya commented on Oct 19, 2021

    @rrraditya

    hi @alexeymyltsev
    I can see that no one handling this issue.
    Do you have any plan or idea on this?
    cause solving this issue will help us a lot and maybe a lot of users too.
    Thank you.

  2. mstinsky commented on Sep 29, 2022

    @mstinsky

    I just ran into the same issue with the openstack exporter where we run into the following error:

    Failed to collect metric for exporter: neutron, error: failed to collect metric: network_ip_availabilities_total, error: math/big: cannot unmarshal \"1.2089258196146292e+24\" into a *big.Int" source="exporter.go:123
    

    This error is triggered by an ipv6 subnet which has 1208925819614629174706175 total ip's. And the deconding runs into the same issue as described by @alexeymyltsev

  3. martialblog commented on Nov 11, 2022

    @martialblog

    Hi, I been looking into this a bit.

    I assume the underlying issue is when decoding a JSON number into an interface{}, the value will be of type float64 regardless of the original type.

    See: https://go.dev/play/p/s3LhzDs-Mu5

    I'm not yet sure where exactly this might happen in the gophercloud code base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions