Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with matchLangIP primitive: boost seems to give wrong hostname #1950

Closed
muellmusik opened this issue Apr 4, 2016 · 6 comments
Closed
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs.
Milestone

Comments

@muellmusik
Copy link
Contributor

So I'm getting a problem with the matchLangIP primitive. It seems that under some circumstances boost::asio::ip::host_name() returns the wrong value?

  1. with wifi off hostname() returns "Scott.local" and all works as expected (returns true or false as appropriate)

  2. on the wifi network where I'm currently sat, hostname() returns "Scott" and throws an exception at boost::asio::ip::udp::resolver::iterator it=resolver.resolve(query);. Here's the dump:

resolve: Host not found (authoritative)
ERROR: Primitive '_MatchLangIP' failed.
Failed.
RECEIVER:
class NetAddr (0x113f68980) {
  instance variables [19]
    name : Symbol 'NetAddr'
    nextclass : instance of Meta_NetBuffers (0x1140dc280, size=19, set=5)
    superclass : Symbol 'Object'
    subclasses : instance of Array (0x115038240, size=3, set=2)
    methods : instance of Array (0x113f68b00, size=28, set=5)
    instVarNames : instance of SymbolArray (0x113f68d80, size=4, set=2)
    classVarNames : instance of SymbolArray (0x113f68f00, size=1, set=2)
    iprototype : instance of Array (0x113f68e40, size=4, set=2)
    cprototype : instance of Array (0x113f68fc0, size=1, set=2)
    constNames : nil
    constValues : nil
    instanceFormat : Integer 0
    instanceFlags : Integer 0
    classIndex : Integer 426
    classFlags : Integer 0
    maxSubclassIndex : Integer 429
    filenameSymbol : Symbol '/code/git_SC/SuperCollider/buildQt5-2/editors/sc-ide/Debug/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/NetAddr.sc'
    charPos : Integer 0
    classVarIndex : Integer 415
}
CALL STACK:
    MethodError:reportError   0x117c0bce8
        arg this = <instance of PrimitiveFailedError>
    Nil:handleError   0x117c0bd98
        arg this = nil
        arg error = <instance of PrimitiveFailedError>
    Thread:handleError   0x117c0beb8
        arg this = <instance of Thread>
        arg error = <instance of PrimitiveFailedError>
    Object:throw   0x117c0bf68
        arg this = <instance of PrimitiveFailedError>
    Object:primitiveFailed   0x117c0c808
        arg this = <instance of Meta_NetAddr>
    Interpreter:interpretPrintCmdLine   0x117c57128
        arg this = <instance of Interpreter>
        var res = nil
        var func = <instance of Function>
        var code = "NetAddr("192.168.1.4", 57120..."
        var doc = nil
        var ideClass = <instance of Meta_ScIDE>
    Process:interpretPrintCmdLine   0x117c0d508
        arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Primitive '_MatchLangIP' failed.
Failed.
RECEIVER: NetAddr

If I hardcode in "Scott.local" as the hostname it works correctly on the wifi network.

Any ideas how this can be solved or what the issue is? @timblechmann if you have any boost fu to offer that would be much appreciated!

@muellmusik muellmusik added the bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. label Apr 4, 2016
@muellmusik
Copy link
Contributor Author

In testing a different issue, I noticed that an Ubuntu machine always returns false for this. Will investigate further.

On OSX btw, I've only encountered the problem on one wifi network. (Unfortunately at a cottage where I was staying, so not able to retest)

@muellmusik
Copy link
Contributor Author

Okay, after doing a little research, it seems that this is actually impossible to get a list of local IP addresses in a cross-platform way. I'm not sure why boost::asio doesn't provide this functionality, but unless someone has a better idea I'm going to proceed with a multiple approach, probably with getifaddrs for linux and Mac, etc., and GetAdapterAddresses on Windows. @bagong if you could help me test the latter, I'd be grateful, as I have no Windows machine here.

@muellmusik
Copy link
Contributor Author

In testing a different issue, I noticed that an Ubuntu machine always returns false for this. Will investigate further.

Just FYI, on the Ubuntu machine it only returns 127.0.1.1.

@miguel-negrao
Copy link
Member

Does #1972 address this issue ? If so this can be closed.

@crucialfelix crucialfelix added this to the 3.8 milestone Apr 21, 2016
@bagong bagong closed this as completed Oct 27, 2016
@vivid-synth
Copy link
Member

Just to check, @muellmusik this does fix the issue?

@muellmusik
Copy link
Contributor Author

should have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs.
Projects
None yet
Development

No branches or pull requests

5 participants