Comments (8)
Interesting, the last segment should be populated with the local network interface address - the first one found that's not loopback
. If there's no such interface, random bytes are used.
If you're seeing all zeros, the result of the network interface lookup must be weird. Can you paste here what :inet.getifaddrs()
returns on your platform?
Also, can you give me any details on what platform, OS, environment, Erlang version, Elixir version etc you're seeing this problem on? And I'm curious what your use case for UUID v1 is?
from elixir-uuid.
Hi Andrei,
I’m using UUID to create user tokens for sessions. I’m using Elixir 1.0.1 and Erlang 17.3 in Docker containers on a MacBook Pro, though I’ve seen the same thing happen on my CentOS test servers, too. Here’s the output of the IF addresses:
{:ok,
[{'lo0',
[flags: [:up, :loopback, :running, :multicast],
addr: {0, 0, 0, 0, 0, 0, 0, 1},
netmask: {65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535},
addr: {127, 0, 0, 1}, netmask: {255, 0, 0, 0},
addr: {65152, 0, 0, 0, 0, 0, 0, 1},
netmask: {65535, 65535, 65535, 65535, 0, 0, 0, 0}]},
{'gif0', [flags: [:pointtopoint, :multicast]]}, {'stf0', [flags: []]},
{'en0',
[flags: [:up, :broadcast, :running, :multicast],
hwaddr: [20, 16, 159, 213, 173, 35],
addr: {65152, 0, 0, 0, 5648, 40959, 65237, 44323},
netmask: {65535, 65535, 65535, 65535, 0, 0, 0, 0}, addr: {192, 168, 1, 66},
netmask: {255, 255, 255, 0}, broadaddr: {192, 168, 1, 255}]},
{'p2p0',
[flags: [:up, :broadcast, :running, :multicast],
hwaddr: [6, 16, 159, 213, 173, 35]]},
{'awdl0',
[flags: [:up, :broadcast, :running, :multicast],
hwaddr: [22, 39, 16, 145, 124, 241],
addr: {65152, 0, 0, 0, 5159, 4351, 65169, 31985},
netmask: {65535, 65535, 65535, 65535, 0, 0, 0, 0}]},
{'en1',
[flags: [:up, :broadcast, :running, :multicast],
hwaddr: [50, 0, 22, 78, 162, 96]]},
{'en2',
[flags: [:up, :broadcast, :running, :multicast],
hwaddr: [50, 0, 22, 78, 162, 97]]},
{'bridge0',
[flags: [:up, :broadcast, :running, :multicast],
hwaddr: [22, 16, 159, 93, 249, 0]]},
{'utun0',
[flags: [:up, :pointtopoint, :running, :multicast],
addr: {65152, 0, 0, 0, 49278, 50886, 17575, 459},
netmask: {65535, 65535, 65535, 65535, 0, 0, 0, 0}, dstaddr: {28, 30, 0, 0},
addr: {64861, 3611, 3017, 15038, 49278, 50886, 17575, 459},
netmask: {65535, 65535, 65535, 65535, 0, 0, 0, 0},
dstaddr: {24, 18, 11, 0}]},
{'vboxnet0',
[flags: [:up, :broadcast, :running, :multicast],
hwaddr: [10, 0, 39, 0, 0, 0], addr: {192, 168, 59, 3},
netmask: {255, 255, 255, 0}, broadaddr: {192, 168, 59, 255}]},
{'vboxnet1', [flags: [:broadcast, :multicast], hwaddr: [10, 0, 39, 0, 0, 1]]},
{'vboxnet2',
[flags: [:broadcast, :multicast], hwaddr: [10, 0, 39, 0, 0, 2]]}]}
Kind regards,
Lee
On 2 Jan 2015, at 15:18, Andrei Mihu [email protected] wrote:
Interesting, the last segment should be populated with the local network interface address - the first one found that's not loopback. If there's no such interface, random bytes are used.
If you're seeing all zeros, the result of the network interface lookup must be weird. Can you paste here what :inet.getifaddrs() returns on your platform?
Also, can you give me any details on what platform, OS, environment, Erlang version, Elixir version etc you're seeing this problem on? And I'm curious what your use case for UUID v1 is?
—
Reply to this email directly or view it on GitHub #2 (comment).
from elixir-uuid.
Interesting, I've plugged in that exact output instead of my call to :inet.getifaddrs()
and I get a valid UUID, like so:
"cc8cdd5c-92d5-11e4-b5a9-14109fd5ad23"
To get the output you pasted above, I assume you opened a terminal and ran iex
. Can you call UUID.uuid1
in that same space? If you get a valid UUID, then it may be something to do with how Docker exposes network interfaces to the application.
from elixir-uuid.
@Lazarus404 Do you still need help with this issue?
from elixir-uuid.
Closing this as not needed anymore. Please ping me if this changes!
from elixir-uuid.
Hi Zyro,
Sorry, yes, still apparent. The OS is CentOS 7. We use UUID in multiple applications in many places, all of which are in Docker, and all have the same problem.
Maybe uuid1 could have an optional attribute to force random bytes?
Thanks,
Lee
from elixir-uuid.
If you're happy with random bytes, maybe uuid4
would give you better results?
Meanwhile I'll try and put together a small project in a Docker container and see how it behaves.
from elixir-uuid.
Thanks. To be honest, I like the datetime based approach of uuid1. I’ve had issues with duplicate values from fully random bytes in the past, due to the way Erlang seeds its random values.
Lee
On 18 Mar 2015, at 19:17, Andrei Mihu [email protected] wrote:
If you're happy with random bytes, maybe uuid4 would give you better results?
Meanwhile I'll try and put together a small project in a Docker container and see how it behaves.
—
Reply to this email directly or view it on GitHub #2 (comment).
from elixir-uuid.
Related Issues (20)
- Offer safe functions that return error tuples on failure instead of raising an exception HOT 3
- UUID.uuid1 fails on docker for mac beta
- Warnings with Erlang 19.0 HOT 2
- uuid1 issue on osx ? HOT 13
- Name collides with erlang UUID package HOT 4
- Why doesn't UUID version 5 give expected results? HOT 3
- UUID.valid?/2 HOT 1
- Instructions in the README don't show change in version and package-name HOT 1
- could not find an app file at "_build/prod/lib/uuid/ebin/uuid.app" HOT 5
- function UUID.uuid4/0 is undefined (module UUID is not available) HOT 3
- string_to_slug and vice versa
- could not find an app file at "_build/dev/lib/uuid/ebin/uuid.app". HOT 1
- uuid1/0 is slow because it gets the MAC address every time HOT 10
- UUID.info parses invalid uuid as valid HOT 1
- V6 UUID HOT 2
- New releases not available on hex.pm HOT 3
- What is this state of this project? HOT 11
- Add a note about the rename in the 1.1 documentation HOT 2
- Non-unique values for UUID.uuid4/0 HOT 2
- Crypto warning when compiling HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elixir-uuid.