Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is causing my HTTP server to fail with "exit status -1073741819"?
    text
    copied!<p>As an exercise I created a small HTTP server that generates random game mechanics, similar to <a href="http://inventwithpython.com/randommechanic.html" rel="nofollow">this one</a>. I wrote it on a Windows 7 (32-bit) system and it works flawlessly. However, when I run it on my home machine, Windows 7 (64-bit), it always fails with the same message: <code>exit status -1073741819</code>. I haven't managed to find anything on the web which references that status code, so I don't know how important it is. </p> <p>Here's code for the server, with redundancy abridged:</p> <pre><code>package main import ( "fmt" "math/rand" "time" "net/http" "html/template" ) // Info about a game mechanic type MechanicInfo struct { Name, Desc string } // Print a mechanic as a string func (m MechanicInfo) String() string { return fmt.Sprintf("%s: %s", m.Name, m.Desc) } // A possible game mechanic var ( UnkillableObjects = &amp;MechanicInfo{"Avoiding Unkillable Objects", "There are objects that the player cannot touch. These are different from normal enemies because they cannot be destroyed or moved."} //... Race = &amp;MechanicInfo{"Race", "The player must reach a place before the opponent does. Like \"Timed\" except the enemy as a \"timer\" can be slowed down by the player's actions, or there may be multiple enemies being raced against."} ) // Slice containing all game mechanics var GameMechanics []*MechanicInfo // Pseudorandom number generator var prng *rand.Rand // Get a random mechanic func RandMechanic() *MechanicInfo { i := prng.Intn(len(GameMechanics)) return GameMechanics[i] } // Initialize the package func init() { prng = rand.New(rand.NewSource(time.Now().Unix())) GameMechanics = make([]*MechanicInfo, 34) GameMechanics[0] = UnkillableObjects //... GameMechanics[33] = Race } // serving var index = template.Must(template.ParseFiles( "templates/_base.html", "templates/index.html", )) func randMechHandler(w http.ResponseWriter, req *http.Request) { mechanics := [3]*MechanicInfo{RandMechanic(), RandMechanic(), RandMechanic()} if err := index.Execute(w, mechanics); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) } } func main() { http.HandleFunc("/", randMechHandler) if err := http.ListenAndServe(":80", nil); err != nil { panic(err) } } </code></pre> <p>In addition, the <a href="http://pastebin.com/naxzbxPc" rel="nofollow">unabridged code</a>, the <a href="http://pastebin.com/c069YJjp" rel="nofollow">_base.html template</a>, and the <a href="http://pastebin.com/d87Hd0WZ" rel="nofollow">index.html template</a>.</p> <p>What could be causing this issue? Is there a process for debugging a cryptic exit status like this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload