Golang垃圾收集器和地图

I'm processing some user session data inside of a goroutine and creating a map to keep track of user id -> session data inside of it. The goroutine loops through a slice and if a SessionEnd event is found, the map key is deleted inside the same iteration. This doesn't seem to always be the case, as I can still retrieve some of the data as well as the 'key exists' bool variable sometimes in the following iterations. It's as if some variables haven't yet been zeroed.

Each map has only one goroutine writing/reading from it. From my understanding there shouldn't be a race condition, but it definitely seems that there is with the map and delete().

The code works fine if the garbage collector is run on every iteration. Am I using a map for the wrong purpose?

Pseudocode (a function that is run inside a single goroutine, lines is passed as a variable):

active := make(ActiveSessions) // map[int]UserSession

for _, l := range lines { // lines is a slice of a parsed log
    u = l.EventData.(parser.User)
    s, exists = active[u.SessionID]

    switch l.Event {
    // Contains cases which can check if exists is true or false
    // errors if contains an event that can't happen, 
    // for example UserDisconnect before UserConnect,
    // or UserConnect while a session is already active

    case "UserConnect":
        if exists {
            // error, can't occur

            // The same session id can occur in the log after a prior session has completed,
            // which is exactly when the problems occur
        }        

    case "UserDisconnect":
        sessionFinished = true

    }

    // ...

    if sessionFinished {
        // <add session to finished sessions>

        delete(active, u.SessionID)

        // Code works only if runtime.GC() is executed here, could just be a coincidence
    }
}