Skip to main content
replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link

To paraphrase what you say in your question, it is not possible to give you a definitive answer. The best we can do is make suggestions of things to look for and tools and techniques.

Some suggestions will appear naive, other may seam more applicable, but hopefully one triggers a thought you can follow up. I must say that the answer by david.pfxanswer by david.pfx has sound advice and suggestions.

From the symptoms

  • to me it sounds like a buffer overrun.

  • a related problem is using unvalidated socket data as a subscript or key, etc.

  • is it possible that you are using a global variable someplace, or have a global and local with the same name, or somehow one player's data interferes with another?

As with many bugs, you are probably making an invalid assumption somewhere. Or possibly more than one. Multiple interacting errors are hard to detect.

  • Does every variable have a description? And can you define a validity assertion?
    If not add those, scan through the code to see that each variable appears to used correctly. Add that assertion wherever it makes sense.

  • The suggestion to add lots assertion is a good one: the first place to put them is on every function entry point. Validate the arguments and any relevant global state.

  • I use lots of logging for debugging long-running / asynchronous / real-time codes.
    Again, insert a log write on every function call.
    If the log files get too large, the logging functions can wrap / switch files / etc.
    It's most useful if the log messages indent with the function call depth.
    Log file can show how a bug propagates. Useful when one piece of code does something not-quite-right that acts as a delayed action bomb.

Many people have their own home grown logging code. I have an old C macro log system somewhere, and maybe a C++ version ...

To paraphrase what you say in your question, it is not possible to give you a definitive answer. The best we can do is make suggestions of things to look for and tools and techniques.

Some suggestions will appear naive, other may seam more applicable, but hopefully one triggers a thought you can follow up. I must say that the answer by david.pfx has sound advice and suggestions.

From the symptoms

  • to me it sounds like a buffer overrun.

  • a related problem is using unvalidated socket data as a subscript or key, etc.

  • is it possible that you are using a global variable someplace, or have a global and local with the same name, or somehow one player's data interferes with another?

As with many bugs, you are probably making an invalid assumption somewhere. Or possibly more than one. Multiple interacting errors are hard to detect.

  • Does every variable have a description? And can you define a validity assertion?
    If not add those, scan through the code to see that each variable appears to used correctly. Add that assertion wherever it makes sense.

  • The suggestion to add lots assertion is a good one: the first place to put them is on every function entry point. Validate the arguments and any relevant global state.

  • I use lots of logging for debugging long-running / asynchronous / real-time codes.
    Again, insert a log write on every function call.
    If the log files get too large, the logging functions can wrap / switch files / etc.
    It's most useful if the log messages indent with the function call depth.
    Log file can show how a bug propagates. Useful when one piece of code does something not-quite-right that acts as a delayed action bomb.

Many people have their own home grown logging code. I have an old C macro log system somewhere, and maybe a C++ version ...

To paraphrase what you say in your question, it is not possible to give you a definitive answer. The best we can do is make suggestions of things to look for and tools and techniques.

Some suggestions will appear naive, other may seam more applicable, but hopefully one triggers a thought you can follow up. I must say that the answer by david.pfx has sound advice and suggestions.

From the symptoms

  • to me it sounds like a buffer overrun.

  • a related problem is using unvalidated socket data as a subscript or key, etc.

  • is it possible that you are using a global variable someplace, or have a global and local with the same name, or somehow one player's data interferes with another?

As with many bugs, you are probably making an invalid assumption somewhere. Or possibly more than one. Multiple interacting errors are hard to detect.

  • Does every variable have a description? And can you define a validity assertion?
    If not add those, scan through the code to see that each variable appears to used correctly. Add that assertion wherever it makes sense.

  • The suggestion to add lots assertion is a good one: the first place to put them is on every function entry point. Validate the arguments and any relevant global state.

  • I use lots of logging for debugging long-running / asynchronous / real-time codes.
    Again, insert a log write on every function call.
    If the log files get too large, the logging functions can wrap / switch files / etc.
    It's most useful if the log messages indent with the function call depth.
    Log file can show how a bug propagates. Useful when one piece of code does something not-quite-right that acts as a delayed action bomb.

Many people have their own home grown logging code. I have an old C macro log system somewhere, and maybe a C++ version ...

Source Link
andy256
  • 3.1k
  • 2
  • 17
  • 20

To paraphrase what you say in your question, it is not possible to give you a definitive answer. The best we can do is make suggestions of things to look for and tools and techniques.

Some suggestions will appear naive, other may seam more applicable, but hopefully one triggers a thought you can follow up. I must say that the answer by david.pfx has sound advice and suggestions.

From the symptoms

  • to me it sounds like a buffer overrun.

  • a related problem is using unvalidated socket data as a subscript or key, etc.

  • is it possible that you are using a global variable someplace, or have a global and local with the same name, or somehow one player's data interferes with another?

As with many bugs, you are probably making an invalid assumption somewhere. Or possibly more than one. Multiple interacting errors are hard to detect.

  • Does every variable have a description? And can you define a validity assertion?
    If not add those, scan through the code to see that each variable appears to used correctly. Add that assertion wherever it makes sense.

  • The suggestion to add lots assertion is a good one: the first place to put them is on every function entry point. Validate the arguments and any relevant global state.

  • I use lots of logging for debugging long-running / asynchronous / real-time codes.
    Again, insert a log write on every function call.
    If the log files get too large, the logging functions can wrap / switch files / etc.
    It's most useful if the log messages indent with the function call depth.
    Log file can show how a bug propagates. Useful when one piece of code does something not-quite-right that acts as a delayed action bomb.

Many people have their own home grown logging code. I have an old C macro log system somewhere, and maybe a C++ version ...