Giter Club home page Giter Club logo

Comments (16)

mlinky avatar mlinky commented on May 21, 2024 3

Hi,

I've made a small change to my script and it now behaves a lot better

Inside:

static shouldRun() {

I have added:

    if (Game.cpu.bucket < 5000) {
        // Additional failsafe for bucket depletion
        log.warning(`CPU bucket is getting low (${Game.cpu.bucket})! Starting CPU reset routine.`);
        Memory.resetBucket = true;
    }

Above:

    if (Memory.resetBucket) {
        if (Game.cpu.bucket < MAX_BUCKET - Game.cpu.limit) {
            log.info(`Operation suspended until bucket recovery. Bucket: ${Game.cpu.bucket}/${MAX_BUCKET}`);
            shouldRun = false;
        }
        else {
            delete Memory.resetBucket;
        }
    }

The script now halts all processing when the bucket reaches 5,000 and waits for it to replenish to 10,000.

Will look at the your fix now too!!

Thanks for looking into this.

from overmind.

bencbartlett avatar bencbartlett commented on May 21, 2024 1

Ah, that is unintended behavior. I'll look into it again.

from overmind.

bencbartlett avatar bencbartlett commented on May 21, 2024 1

Sorry this has taken so long to get around to; I've been pretty busy the last two weeks. Here is how I understand this bug: I added Game.cpu.halt() to the CPU reset routine to fix some weird heap issues that I have been experiencing on shard2. However, in low-CPU environments like shard3, the amount of CPU you accumulate per tick is less than the cost of parsing the ~1MB main.js file on the tick following Game.cpu.halt(). This can cause the bucket to dip back below the CPU-reset threshold, causing the endless cycle of CPU resets. I have pushed a short fix in the latest commit which should fix this problem, but I'll leave this issue open until @Evanito and/or @mlinky can confirm that the problem is no longer an issue.

from overmind.

bencbartlett avatar bencbartlett commented on May 21, 2024 1

@mlinky Glad to hear the bug is fixed now. The bucket recovery strategy was designed for use in shard2 and probably isn't the best idea for shard3. I plan to improve this later, once I establish a foothold in shard3, but feel free to make a separate issue if you find the current bucket recovery system problematic.

from overmind.

bencbartlett avatar bencbartlett commented on May 21, 2024

This should be fixed as of this commit. Feel free to reopen the issue if it is still a problem.

from overmind.

Evanito avatar Evanito commented on May 21, 2024

Not fixed as intended.
While it no longer gets stuck at 0 CPU, I get a CPU Halted. red error message in console about the time that it would report getting 500 CPU in the bucket, which puts it back below 500 and the cycle repeats. If I manually pause until it exceeds 500CPU (say, 1000) then it will not get this error.

Also I am unable to reopen this issue, I assume because of GitHub permissions.

from overmind.

Evanito avatar Evanito commented on May 21, 2024

To clarify, the only output it shows is

[2:31:46 PM][shard3]INFO    3781874 Operation suspended until bucket recovery. Bucket: 496/10000
CPU Halted.
[2:31:4X PM][shard3]INFO    378187X Operation suspended until bucket recovery. Bucket: 472/10000
[2:31:5X PM][shard3]INFO    378187X Operation suspended until bucket recovery. Bucket: 487/10000

from overmind.

bencbartlett avatar bencbartlett commented on May 21, 2024

The CPU Halted. message is not an error; it is the manual clearing of the global heap. You can see the reset logic in src/memory/Memory.ts. The snippet you have pasted looks normal; the intended behavior is that operation will suspend until the bucket recovers. You should get something like this:

[2:31:46 PM][shard3]INFO    3781874 Operation suspended until bucket recovery. Bucket: 485/10000
CPU Halted.
[2:31:4X PM][shard3]INFO    378187X Operation suspended until bucket recovery. Bucket: 502/10000
[2:31:5X PM][shard3]INFO    378187X Operation suspended until bucket recovery. Bucket: 519/10000
[2:31:5X PM][shard3]INFO    378187X Operation suspended until bucket recovery. Bucket: 538/10000
...
[2:31:5X PM][shard3]INFO    378187X Operation suspended until bucket recovery. Bucket: 9980/10000
<Normal operation resumes>

Is the behavior you are seeing different from this? If so, please explain.

from overmind.

Evanito avatar Evanito commented on May 21, 2024

The problem I am getting is that it puts it back below 500, then repeats indefinitely.
This may be due to being on shard3 (20 CPU limit)

from overmind.

bencbartlett avatar bencbartlett commented on May 21, 2024

Once the bucket dips below 500, it should stop all operation and wait until it is full again before resuming. Is this not what you are seeing?

from overmind.

Evanito avatar Evanito commented on May 21, 2024
[5:26:17 PM][shard3]CPU halted
[5:26:19 PM][shard3]ALERT   3785565 Codebase updated or global reset. Type "help" for a list of console commands.
                ‣ Version:        Overmind v0.5.1
                ‣ Checksum:       0x355112ac510
                ‣ Assimilated:    No (clearance code: null) [WIP]
                ‣ Operating mode: automatic
[5:26:19 PM][shard3]INFO    3785565 Operation suspended until bucket recovery. Bucket: 504/10000
[5:26:21 PM][shard3]WARNING 3785566 CPU bucket is critically low (460)! Starting CPU reset routine.
[5:26:21 PM][shard3]INFO    3785566 Operation suspended until bucket recovery. Bucket: 460/10000
[5:26:24 PM][shard3]WARNING 3785567 CPU bucket is critically low (478)! Starting CPU reset routine.
[5:26:24 PM][shard3]INFO    3785567 Operation suspended until bucket recovery. Bucket: 478/10000
[5:26:27 PM][shard3]WARNING 3785568 CPU bucket is critically low (496)! Starting CPU reset routine.
[5:26:27 PM][shard3]INFO    3785568 Operation suspended until bucket recovery. Bucket: 496/10000
[5:26:29 PM][shard3]CPU halted
[5:26:32 PM][shard3]ALERT   3785570 Codebase updated or global reset. Type "help" for a list of console commands.
                ‣ Version:        Overmind v0.5.1
                ‣ Checksum:       0x355112ac510
                ‣ Assimilated:    No (clearance code: null) [WIP]
                ‣ Operating mode: automatic
[5:26:32 PM][shard3]INFO    3785570 Operation suspended until bucket recovery. Bucket: 513/10000
[5:26:35 PM][shard3]WARNING 3785571 CPU bucket is critically low (469)! Starting CPU reset routine.
[5:26:35 PM][shard3]INFO    3785571 Operation suspended until bucket recovery. Bucket: 469/10000
[5:26:38 PM][shard3]WARNING 3785572 CPU bucket is critically low (487)! Starting CPU reset routine.
[5:26:38 PM][shard3]INFO    3785572 Operation suspended until bucket recovery. Bucket: 487/10000
[5:26:41 PM][shard3]CPU halted
[5:26:44 PM][shard3]ALERT   3785574 Codebase updated or global reset. Type "help" for a list of console commands.
                ‣ Version:        Overmind v0.5.1
                ‣ Checksum:       0x355112ac510
                ‣ Assimilated:    No (clearance code: null) [WIP]
                ‣ Operating mode: automatic
[5:26:44 PM][shard3]INFO    3785574 Operation suspended until bucket recovery. Bucket: 505/10000
[5:26:45 PM][shard3]WARNING 3785575 CPU bucket is critically low (448)! Starting CPU reset routine.
[5:26:45 PM][shard3]INFO    3785575 Operation suspended until bucket recovery. Bucket: 448/10000
[5:26:48 PM][shard3]WARNING 3785576 CPU bucket is critically low (465)! Starting CPU reset routine.
[5:26:48 PM][shard3]INFO    3785576 Operation suspended until bucket recovery. Bucket: 465/10000
[5:26:51 PM][shard3]WARNING 3785577 CPU bucket is critically low (483)! Starting CPU reset routine.
[5:26:51 PM][shard3]INFO    3785577 Operation suspended until bucket recovery. Bucket: 483/10000
[5:26:54 PM][shard3]WARNING 3785578 CPU bucket is critically low (490)! Starting CPU reset routine.
[5:26:54 PM][shard3]INFO    3785578 Operation suspended until bucket recovery. Bucket: 490/10000
[5:26:57 PM][shard3]CPU halted
[5:27:00 PM][shard3]ALERT   3785580 Codebase updated or global reset. Type "help" for a list of console commands.
                ‣ Version:        Overmind v0.5.1
                ‣ Checksum:       0x355112ac510
                ‣ Assimilated:    No (clearance code: null) [WIP]
                ‣ Operating mode: automatic
[5:27:00 PM][shard3]INFO    3785580 Operation suspended until bucket recovery. Bucket: 508/10000
[5:27:02 PM][shard3]WARNING 3785581 CPU bucket is critically low (439)! Starting CPU reset routine.
[5:27:02 PM][shard3]INFO    3785581 Operation suspended until bucket recovery. Bucket: 439/10000
[5:27:05 PM][shard3]WARNING 3785582 CPU bucket is critically low (456)! Starting CPU reset routine.
[5:27:05 PM][shard3]INFO    3785582 Operation suspended until bucket recovery. Bucket: 456/10000
[5:27:08 PM][shard3]WARNING 3785583 CPU bucket is critically low (474)! Starting CPU reset routine.
[5:27:08 PM][shard3]INFO    3785583 Operation suspended until bucket recovery. Bucket: 474/10000

Log shows more than I initially reported, my apologies.

from overmind.

mlinky avatar mlinky commented on May 21, 2024

This is also happening to me now that I am at GCL 3 on shard 3. The colonies have no creeps and the log file is exactly as above.

from overmind.

Evanito avatar Evanito commented on May 21, 2024

It may be conflated with a related problem: Running two colonies (8[2 outposts]/7[5 outposts]) on shard3 puts me at 75% CPU consistently. This does not leave enough for a third potential colony, but one is formed anyway and drains the bucket.

Potential solution: Calculate max colonies based on average CPU usage per colony instead of the hard 3 for shard3?

I solved my death spiral by entering semiautomatic and abandoning my third colony, when I have time to micromanage I will purposefully test the new commit.

from overmind.

bencbartlett avatar bencbartlett commented on May 21, 2024

@mlinky I think that change conflicts with some of the other changes I have made to Mem recently, but if it works for you, that's great. However, can you test fix I pushed recently as-is, without any modifications, and let me know if it works? If so, then I can finally close this issue. Thanks!

from overmind.

mlinky avatar mlinky commented on May 21, 2024

With your fix in place it no longer falls into a terminal loop. So the fix is good. The console message is still misleading, it says postponing operations until bucket reaches 500, but really nothing happens until the bucket reaches 10000.

from overmind.

mlinky avatar mlinky commented on May 21, 2024

Watching this run through, I'm wondering if recovering 9500 bucket while all your creeps sit and decay is a good plan? Maybe only recovering 20 per tick on shard3 is part of the problem? Seems like the long delay means that most colonies are needing to respawn creeps to recover from the extended downtime instead of just carrying on with business.
Is it possible that the trigger level for the bucket should be in proportion to the amount that can be recovered per tick instead?

from overmind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.