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

Completion of error handling #33

Closed
elfring opened this issue Aug 31, 2013 · 13 comments
Closed

Completion of error handling #33

elfring opened this issue Aug 31, 2013 · 13 comments

Comments

@elfring
Copy link

elfring commented Aug 31, 2013

I have looked at a few source files for your current software. I have noticed that some checks for return codes are missing.

Would you like to add more error handling for return values from functions like the following?

@cloudwu
Copy link
Owner

cloudwu commented Aug 31, 2013

I my opinion, check Malloc here is no necessary, because if the system was out of memory, it can't run .
Skynet runs on 64bit architecture with very large memory ( 32G or more )
If malloc() returns null , the only thing can do is exit the process. We can hook the malloc() to do this instead of checking malloc everywhere.

@elfring
Copy link
Author

elfring commented Sep 1, 2013

I would appreciate if return values will also be checked from Pthread functions.
Are you interested in a different reaction than a program abort eventually?

@cloudwu
Copy link
Owner

cloudwu commented Sep 1, 2013

The program will be ok even pthread_cond_signal failed . I can do nothing when it failed, and program never abort when it failed.

@cloudwu cloudwu closed this as completed Sep 1, 2013
@elfring
Copy link
Author

elfring commented Sep 1, 2013

@cloudwu
Copy link
Owner

cloudwu commented Sep 1, 2013

I add some check for pthread api just now, thanks.

@elfring
Copy link
Author

elfring commented Sep 1, 2013

Thanks for this small improvement.

I find such a source code adjustment still incomplete. I do not know why you seem to prefer so far to ignore return values from relevant function calls.

@cloudwu
Copy link
Owner

cloudwu commented Sep 1, 2013

If it fails, only I can do is exit . and any reason of exit (even segment
fault sometimes ) is the same to me.

I know how my system works and ignore the error call I don't care.

2013/9/1 Markus Elfring notifications@github.com

Thanks for this little improvement.

I find such a source code adjustmenthttps://github.com/cloudwu/skynet/commit/56f6e0e62d1a2dd5a261a705536dbf8543fb67a4still incomplete. I do not know why you seem to prefer so far to ignore
return values from relevant function calls.


Reply to this email directly or view it on GitHubhttps://github.com//issues/33#issuecomment-23626864
.

http://blog.codingnow.com

@elfring
Copy link
Author

elfring commented Sep 1, 2013

Return value ignorance can result in software which contains a couple of open issues. I guess that other users might also be more interested in detailed failure reasons for your program.

@cloudwu
Copy link
Owner

cloudwu commented Sep 1, 2013

The return values I ignore never break the program. sometimes we don't care about success or failed because they do it continuous, just like keep alive each other. If we find something wrong from other way, only thing we can do is kill the process and reboot the whole system.

@elfring
Copy link
Author

elfring commented Sep 1, 2013

Wrong. - Why do you perform a computation if you are not interested in the corresponding return value at all?

How long will your program run until the violation of an invariant will be detected?

@cloudwu
Copy link
Owner

cloudwu commented Sep 1, 2013

You haven't read my code and understand how and why I ignore these .

Some times I don't care the result, I do the same things over and over, The next step is not depend on the last step, so just do it. If some thing wrong with the system, just kill the whole process and reboot it.

The os protects it can't do bad things, it's enough.

@microcai
Copy link

Why do you perform a computation if you are not interested in the corresponding return value at all?

@elfring
Copy link
Author

elfring commented Mar 31, 2014

Does return value ignorance affect software correctness?

Do other software developers and testers care more for risks from unused return values?

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

No branches or pull requests

3 participants