--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/Qg4CNgC7RPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
But, still, until you need emergency call, power, water, healtcare, workplace security, please consider there is boring people
Our applications written in Java are crashing thread by thread, and the server not only keeps running: it keeps *operating*.
The same for the one written in C++ and ADA. We are testing some written in erlang.
Golang looks very promising, and my suggestion was only to implement a mechanism of panicking which
only affects one thread, and not crashing the whole server.
And maybe you are not even entitled to teach operations to me, btw.
--
package mainimport ("bytes""io")func main() {var a, b bytes.Bufferbuf := make([]byte, a.Len())io.CopyBuffer(&b, &a, buf)}
Uhm... from the operation's department point of view, I don't agree
with this approach.
Ok, sure in a perfect world software has no bugs. In a perfect world
thigs which
should not happen aren't happening.
Now, put it in my position. You handover me your amazing server, which
I am supposed
to keep running 24/7, and 99.999 of SLA.
And you say "if any error" not only one thread will crash, but the whole
server will. And please notice, this server was started by a shell, and
I have no idea if
an attacker can get a shell just after the server crashes: I can't
predict the effects of a crash.
John Souvestre <jo...@souvestre.com> writes:
> Planning for the worst does not mean ignoring the non-worst cases.
> Following your logic, all car crashes should be treated as fatal,
> hence there is no reason to wear seat belts or to install airbags.
That is just a horrifyingly cynical strawmen.
What I said was that your SLA is pretty much meaningless if you can't
handle the crash of a program without any problems. Unless you are
unrealistically good at writing incredibly resilient software. And in
that case, this one additional thing you have to check for your
unbelievable trackrecord of stable software won't really make a
difference anyway.
A hypothetical SLA was brought up as an argument for a change to a
language implementation detail. In my opinion, that is simply a very
weak argument. Because the solution to this hypothetical SLA-Problem is
"you should think better about your SLA".
I agree with Paul here. A public package that panics instead of returning an error makes for a fragile system and forces a defensive programming style.
Not to mention each defense will be different (as we already saw in this CopyBuffer case). How would you like it if the OS panicked instead of returning an error on a syscall with invalid arguments?
Ultimately it must be the user who is in charge. A service must check its inputs and refuse to provide service if given invalid inputs but killing a client seems extreme.
Particularly when Go makes it so easy to return errors. Panic *is* the right response if some internal consistency check fails but not for client mistakes.
The fact that so many stdlib packages can panic is not an argument in favor of panicking; it is an argument in favor of critically (re)examining these panics : )
If it killed the currently running process / thread I would be fine with it. A syscall with invalid arguments is a programmer error.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/Qg4CNgC7RPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
On Aug 12, 2015, at 10:26 AM, Matt Harden <matt....@gmail.com> wrote:On Wed, Aug 12, 2015 at 10:07 AM Bakul Shah <ba...@bitblocks.com> wrote:I agree with Paul here. A public package that panics instead of returning an error makes for a fragile system and forces a defensive programming style.How does this force a defensive programming style?
Not to mention each defense will be different (as we already saw in this CopyBuffer case). How would you like it if the OS panicked instead of returning an error on a syscall with invalid arguments?If it killed the currently running process / thread I would be fine with it. A syscall with invalid arguments is a programmer error.
Ultimately it must be the user who is in charge. A service must check its inputs and refuse to provide service if given invalid inputs but killing a client seems extreme.The guideline is to panic on *bugs* - *programmer errors*, not invalid user inputs.
Particularly when Go makes it so easy to return errors. Panic *is* the right response if some internal consistency check fails but not for client mistakes.Panic is also the right response when a clear bug in the code is detected by a library, to maximize the information the programmer has to fix said bug. And when panics are documented well, which is the case here, no programmer can claim he wrote correct code that panicked unexpectedly.
The fact that so many stdlib packages can panic is not an argument in favor of panicking; it is an argument in favor of critically (re)examining these panics : )Since my programs seldom panic in the absence of programmer error, I conclude that the stdlib authors have done a fantastic job of putting panics in just the right places. :-)
I think, far easier, actually. Program X has a bug, syscalls with wrong
arguments, dumps core. Attach gdb to coredump, dump
stacktrace. Stacktrace will contain location of buggy syscall. Hunt for bug.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/Qg4CNgC7RPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
You cannot recover panics that happen in other goroutines (since this discussion is no longer about just io.CopyBuffer but the philosophy of panics).Someone making nonsensical error messages is a problem, returning errors is not.Anyhow, my experience has taught me that you abort/panic as last resort if you are producing a product for sale and/or wide external use. Others may have had different experiences. I am glad I am not currently writing software for sale, I can be much more lazy when my customer is just other engineers.I doubt I will move over to the "panics are cool if I think the calling program is broken." Sounds like others will not move out of it. Nothing is perfect, and perfection is subjective.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/Qg4CNgC7RPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
Serious question - do you not consider calling a function using arguments that are explicitly documented as being incorrect a form of being broken? I'm not asking sarcastically - I think that may be a difference of opinion, but it's an interesting discussion to have if we do in fact disagree about it.
only ever generate a non-recovered panic in a public library if memory safety has been compromised
Everything I've read in this (long) thread seems to focus on developer apps or servers and recommends "just record the panic and restart". That's not acceptable/possible for an application in use by "mere mortals". Imagine if the C std lib just aborted instead of returning errors? That would make it effectively useless for writing consumer-facing applications.
On Wednesday, August 12, 2015 at 7:40:22 PM UTC-4, Axel Wagner wrote:Andy Maloney <asma...@gmail.com> writes:
> I have to agree 100% with Paul's take on it. Not everyone is using Go for
> servers or command-line tools. One use case I have not seen in this thread
> is the one I'm looking at: using Go to create a C archive that I can link
> into a C++ application. If Go is to be useful in this case, then anything
> in the standard lib that can return an error instead of panicking should do
> so.
One Question: why? i.e. why do the arguments brought up in this thread
for programs written in go do not apply to this usecase in the exact
same way? :)
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/Qg4CNgC7RPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/Qg4CNgC7RPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
On 11 August 2015 at 04:41, Uriel Fanelli <uriel....@gmail.com> wrote:But, still, until you need emergency call, power, water, healtcare, workplace security, please consider there is boring peopleThis may sound facetious, and I apologize if it comes across that way, but I would be very disturbed if any of these critical services would be affected by a single process crashing.Our applications written in Java are crashing thread by thread, and the server not only keeps running: it keeps *operating*.
The same for the one written in C++ and ADA. We are testing some written in erlang.In a shared memory environment when a thread (or goroutine) "crashes" for whatever reason, it is impossible to make any assurances about the correctness or reliability of the rest of the process. That's why a panicking goroutine can take down an entire Go process. This was a deliberate design decision.Golang looks very promising, and my suggestion was only to implement a mechanism of panicking which
only affects one thread, and not crashing the whole server.Such a mechanism exists, and it's called "recover". So if you are careful you can write software in Go that can recover from panics. But for the reason I gave above, you should be very judicious in using this technique.And maybe you are not even entitled to teach operations to me, btw.This kind of defensive statement adds nothing whatsoever to the discussion. Please stick to technical concepts rather than arguing from authority. Although if you do want to think in those terms, please consider Google's experience in building and operating production systems.Andrew
Because in such a conditions you have (or you risk to have, depending by your implementation) a buffer which you suppose to have something inside, which is not.
When you use I/O you assume, i.e. "since the file is open and your seek pointer is set, then we can read". It is a OS problem to make this happens.
Mentioning SAN I mentioned the most common case where a read operation which the developer can assume to be able to read a buffer , while it cannot.
When you manage a I/O operation, you assume it is atomic, be example, but this is not the case of SAN. Of course it is the job of the SAN to abstract it an represent to you as atomic. So could get the size of the file and a seek pointer from the -some vendor here- metadata pool, which is hosted on some ssd raid, and reading i.e. 1024 bytes. unfortunately, the data pool of the storage, which is a separate entity, could be unable to serve the actual read, because it is being failovered. So your assumption of atomicity could be wrong, and there is very little the kernel of your operating system can do.
This problems are mitigated by checksummed filesystems like zfs on solaris and others, but not all filesystems are like zfs. And this is only a mitigation.
So my idea is to enforce as many robustness as possible on libraries, because even the so-call devops cannot take care of any specific infrastructure issue. The fact the underlying infrastructure can , due of inherent complexity, crack any assumption (tcp state machine, I/O is atomic, and so on) make me think of MITIGATING any risk.
Again, it is not that you can predict what can happen, it is you don't want to learn what can go wrong *in your face*. In 20+ years of operation i have seen a ton of developers saying "but in theory this should work like that" . And then you see it will be fixed patching the os -two months later- , you will see how peculiar branded hardware behaves, and so on.
As I repeated, it is about to avoid patterns of risks and enforce good practices. The price of this is hard to measure, until is too late.