Skip to content

move close into non error block and defer it - #2

Open
mcqueenorama wants to merge 2 commits into
ARolek:masterfrom
mcqueenorama:master
Open

move close into non error block and defer it#2
mcqueenorama wants to merge 2 commits into
ARolek:masterfrom
mcqueenorama:master

Conversation

@mcqueenorama

Copy link
Copy Markdown

I found that if the a host was not in dns then the req close was causing a panic.

@ARolek

ARolek commented Nov 25, 2014

Copy link
Copy Markdown
Owner

@mcqueenorama this patch is going to cause a memory leak. defer res.Body.Close() wont be called since we're in a for loop. The way I had it also fails now that I look at it.

When you say the "host was not in DNS" are you talking about failing to reach the host (i.e. your network is down?)

@mcqueenorama

Copy link
Copy Markdown
Author

You are right, I guess drop the defer. I added it as an afterthought, but its wrong.

Regarding the DNS comment, I think I tested by putting in a stupid dbs name, and i also tested it by pointing at localhost to some unused port. Anyway, you can see the problem I was worrying about.

BTW Its a fun and useful tool. I've got it watching the flapjack server as a second tier backup. If flapjack goes down this will notify me. I was thinking of adding stuff like handlers, but there's plenty of fancy stuff out there. I like the simplicity of this.

@ARolek

ARolek commented Nov 25, 2014

Copy link
Copy Markdown
Owner

I just pushed up some code changes per your pull request. Take a look and see if they fix your issue (I tested it and it works on my end). I will then prepare a build for release.

Thanks for the positive feedback on the project too. This was actually my first Go program. I was evaluating several languages to figure out which one I wanted to jump into next, and I feel in love with Go after building lilpinger.

The whole goal was to not have too many bells and whistles while being an useable tool. I'm glad you appreciate that. It's easy to get carried away as a developer. ;-)

@mcqueenorama

Copy link
Copy Markdown
Author

It looks good! I just did my first small go projects too - a few nagios
checks. I'm liking it too. Check out this one. Its one of my favorite
projects right now and its go:

https://github.com/chrislusf/weed-fs

On Tue, Nov 25, 2014 at 12:15 PM, Alexander Rolek notifications@github.com
wrote:

I just pushed up some code changes per your pull request. Take a look and
see if they fix your issue (I tested it and it works on my end). I will
then prepare a build for release.

Thanks for the positive feedback on the project too. This was actually my
first Go program. I was evaluating several languages to figure out which
one I wanted to jump into next, and I feel in love with Go after building
lilpinger.

The whole goal was to not have too many bells and whistles while being an
useable tool. I'm glad you appreciate that. It's easy to get carried away
as a developer. ;-)


Reply to this email directly or view it on GitHub
#2 (comment).

the news wire of the 21st century - twitchy.com

@ARolek

ARolek commented Nov 26, 2014

Copy link
Copy Markdown
Owner

I just pushed up a new release with the fixes. thanks again for reporting them.

that's quite the project you're building. what's the motivation? personal exploration or did you have a business problem that needed solving?

@mcqueenorama

Copy link
Copy Markdown
Author

That one's not mine. Its my favorite, and I wish I'd thought of it myself. I intend to use it for probably many different use cases. Its a distributed http based file system. Its an implementation of Facebook's Haystack. If you want to access objects via http and want them replicated in a cloud, it makes it trivial to jam objects in and they replicate to the cloud and they are immediately and simply accessible via http. For instance images for a web site and you want them replicated to data centers around the world. Publish them trivially via http to weed-fs, and they go around the world and are accessible immediately via http.

@mcqueenorama

Copy link
Copy Markdown
Author

It's just for fun but I do want to put it to work in the business too. I'm
at Walmart labs and we have a lot of big data. I mostly think it's a cool
project that will have wide application and its an excuse to do go.

On Wednesday, November 26, 2014, Alexander Rolek notifications@github.com
wrote:

I just pushed up a new release with the fixes. thanks again for reporting
them.

that's quite the project you're building. what's the motivation? personal
exploration or did you have a business problem that needed solving?


Reply to this email directly or view it on GitHub
#2 (comment).

the news wire of the 21st century - twitchy.com

@ARolek

ARolek commented Nov 30, 2014

Copy link
Copy Markdown
Owner

I see. It looks like a pretty amazing tool. I don't currently have use for it. For storage needs I typically use S3, which also has it's downsides. Keep me in the loop as you play with the tool though. I always like to keep up with these types of distributed systems.

That's great Walmart Labs is allowing you to play with Go. I think the language is well positioned and will be adopted by enterprises in the not to distant future. ;-)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants