Giter VIP home page Giter VIP logo

Comments (7)

colinmarc avatar colinmarc commented on June 27, 2024

from hdfs.

kof02guy avatar kof02guy commented on June 27, 2024

Hi Colinmark,
I've changed this but got the following error
dial tcp 192.168.0.38:8020: getsockopt: connection refused
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x467f5e]

goroutine 1 [running]:
panic(0x565260, 0xc42000c100)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
audience/vendor/github.com/colinmarc/hdfs.(*Client).getFileInfo(0x0, 0x5960f9, 0x8, 0xc420067e70, 0x45c807, 0x64eac0, 0xc420046010)
/export/bzhang/devCodeForPrd/common/src/go/src/audience/vendor/github.com/colinmarc/hdfs/stat.go:35 +0xfe
audience/vendor/github.com/colinmarc/hdfs.(*Client).Open(0x0, 0x5960f9, 0x8, 0x3b, 0x0, 0x0)
/export/bzhang/devCodeForPrd/common/src/go/src/audience/vendor/github.com/colinmarc/hdfs/file_reader.go:34 +0x49
main.main()
/export/bzhang/devCodeForPrd/common/src/go/src/audience/new_audience/file_translator/test2.go:11 +0xe2
It seems that the port is not opened.

I can contact hdfs using github.com/vladimirvivien/gowfs

from hdfs.

colinmarc avatar colinmarc commented on June 27, 2024

github.com/vladimirvivien/gowfs uses WebHDFS, so that makes sense. I'd guess either you're using a nonstandard port (I've seen 9000 used elsewhere) or you have a firewall blocking access.

That panic doesn't look great, though, so I'll leave this open for now.

from hdfs.

colinmarc avatar colinmarc commented on June 27, 2024

Hm, can you post more of the traceback, actually? It looks like you're calling Open on a nil Client.

from hdfs.

kof02guy avatar kof02guy commented on June 27, 2024

I made some changes to this piece of code:
`package main

import (
"fmt"
"github.com/colinmarc/hdfs"
)

func main() {
client, err := hdfs.New("192.168.0.38:9000")
fmt.Printf("client:%v err:%v\n", client, err)
file, err := client.Open("testfile")
fmt.Printf("file:%v err:%v\n", file, err)
}`

and its output:

client:<nil> err:dial tcp 192.168.0.38:9000: getsockopt: connection refused
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x467c3e]

goroutine 1 [running]:
panic(0x565260, 0xc42000c100)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
audience/vendor/github.com/colinmarc/hdfs.(*Client).getFileInfo(0x0, 0x5960f9, 0x8, 0x64ea80, 0xc420048010, 0x597f0f, 0x11)
        /export/bzhang/devCodeForPrd/common/src/go/src/audience/vendor/github.com/colinmarc/hdfs/stat.go:35 +0xfe
audience/vendor/github.com/colinmarc/hdfs.(*Client).Open(0x0, 0x5960f9, 0x8, 0x2, 0x2, 0x4c)
        /export/bzhang/devCodeForPrd/common/src/go/src/audience/vendor/github.com/colinmarc/hdfs/file_reader.go:34 +0x49
main.main()
        /export/bzhang/devCodeForPrd/common/src/go/src/audience/new_audience/file_translator/test2.go:11 +0x10b

when I use 50070 as its port to open:

client:&{0xc4200ec000 <nil>} err:<nil>
1213486160 &{{0xc4200740e0}}
unexpected EOF
file:<nil> err:open testfile: unexpected EOF

I added one line in namenode.go

func (c *NamenodeConnection) readResponse(method string, resp proto.Message) error {
    var packetLength uint32
    err := binary.Read(c.conn, binary.BigEndian, &packetLength)
    if err != nil {
        return err
    }

    packet := make([]byte, packetLength)
    fmt.Println(packetLength, c.conn)
    ...
}

and the Println outputs "1213486160 &{{0xc4200740e0}}"

So I think 50070 is ok, but the response decode failed. And I've tried 8020 and 9000, but both these 2 ports can not be connected to generate a valid client as you can see.

from hdfs.

kof02guy avatar kof02guy commented on June 27, 2024

Thank you very much. I've found the reason for the problem. I should use 127.0.0.1 as the address to open because HDFS opens its IPC port on 127.0.0.1 instead of 0.0.0.0
I use 127.0.0.1:9000 and the error is gone

from hdfs.

colinmarc avatar colinmarc commented on June 27, 2024

Great - I'm going to close this, but feel free to reopen if you find any new issues.

from hdfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.