_resolveCurrent() is called by _resolve() when `_resolved` is set to false. The bug is here: `_resolved` is, as far as I can tell, never set to `true`.
_resolve() is called in the `names` getter; the `names` getter is called by `name`'s getter, which is called by ProcessInfo.hostname against the `Host.current()` object.
Fix is to set _resolved to `true` after `_resolveCurrent()` succeeds.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug | |Assignee | swizzlr (JIRA) | |Priority | Medium | md5: eb2a2f92784172873e4d6e8c88472cf1Issue Description:
This was a fun bug to track down. `massif` is amazing, tho.
https://github.com/apple/swift-corelibs-foundation/blob/swift-4.0-branch/Foundation/Host.swift#L85 is the line where _addresses is appended to with a string.
_resolveCurrent() is called by _resolve() when `_resolved` is set to false. The bug is here: `_resolved` is, as far as I can tell, never set to `true`.
_resolve() is called in the `names` getter; the `names` getter is called by `name`'s getter, which is called by ProcessInfo.hostname against the `Host.current()` object.
Fix is to set _resolved to `true` after `_resolveCurrent()` succeeds.
Workaround is to cache the hostname elsewhere.