iann0036 / former2

Generate CloudFormation / Terraform / Troposphere templates from your existing AWS resources.
https://former2.com
MIT License
2.22k stars 268 forks source link

ecs scanning never complete #155

Open mysnoopy opened 3 years ago

mysnoopy commented 3 years ago

trying to pull info from ecs cluster. but it takes forever and holding at the loading spinning wheel. the former2 has read only access permission. the same permission is working fine with other services.

iann0036 commented 3 years ago

Hi @mysnoopy,

Thanks for raising!

I've pushed an update to potentially help with some scanning issues, however I can't yet tell what your exact issue could be. If it's still an issue, could you let me know which tabs within ECS (Clusters, Services etc.) are being blocked by the loading wheel?

Also, if you see any errors on screen or within the JavaScript console (located at View -> Developer -> JavaScript Console on Chrome).

mysnoopy commented 3 years ago

same problem. the loading wheel stays on loading for 5mins. i was on ecs->cluster tab. i tried on services and task def. they have the same behavior.

Screen Shot 2021-03-09 at 6 49 52 PM

iann0036 commented 3 years ago

Very weird!

The error might be getting caught up in the extension then. If you're in Chrome, you can check if it has any errors by navigating to chrome://extensions/?id=fhejmeojlbhfhjndnkkleooeejklmigi and clicking the background page link to pull up its console.

I'd love to help fix this personally for you if there's nothing obvious in the above. If you're happy to do a quick remote session, ping me at contact @ ianmckay.com.au and we can have a look together.

mysnoopy commented 3 years ago

Btw.. saw this as well. hope they will give you some idea.

Failed to load resource: the server responded with a status of 503 (Service Unavailable) ec2.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 503 (Service Unavailable) aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 ec2.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 503 (Service Unavailable) aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 ec2.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 503 (Service Unavailable) aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 ec2.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 503 (Service Unavailable) ec2.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 503 (Service Unavailable) aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 aws-sdk-2.858.0.js:10124 Failed to load resource: Request throttled. Visit https://dev.chromium.org/throttling for more information. handleRequest @ aws-sdk-2.858.0.js:10124 ec2.us-east-1.amazonaws.com/:1

[image: Screen Shot 2021-03-09 at 9.02.00 PM.png]

hey..

got the following errors. plese the attached image.

Failed to load resource: the server responded with a status of 400 (Bad Request) elasticloadbalancing.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 400 (Bad Request) glue.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 400 () elasticloadbalancing.us-east-1.amazonaws.com/:1 Failed to load resource: the server responded with a status of 400 (Bad Request) elasticloadbalancing.us-east-1.amazonaws.com/:1

[image: Screen Shot 2021-03-09 at 8.49.41 PM.png]

On Tue, Mar 9, 2021 at 7:08 PM Ian Mckay notifications@github.com wrote:

Very weird!

The error might be getting caught up in the extension then. If you're in Chrome, you can check if it has any errors by navigating to chrome://extensions/?id=fhejmeojlbhfhjndnkkleooeejklmigi and clicking the background page link to pull up its console.

I'd love to help fix this personally for you if there's nothing obvious in the above. If you're happy to do a quick remote session, ping me at contact @ ianmckay.com.au and we can have a look together.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iann0036/former2/issues/155#issuecomment-794792492, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5NSGH7JPO67PMKGAIGB3DTC3PCRANCNFSM4Y2EFRCQ .

iann0036 commented 3 years ago

Ah, throttling is interesting - I thought I had fixed the majority of those issues. Do you have a massive amount of resources (probably instances/ELB/NICs etc)?

Are you scanning the entire account and then going to the ECS service page or just hitting ECS directly? If the former, could you try visiting the ECS page without scanning and seeing if the problem persists?

mysnoopy commented 3 years ago

Yea. My account is kind of big. I just went direct to the esc paper without scan.

On Mar 9, 2021, 9:07 PM -0800, Ian Mckay notifications@github.com, wrote:

Ah, throttling is interesting - I thought I had fixed the majority of those issues. Do you have a massive amount of resources (probably instances/ELB/NICs etc)? Are you scanning the entire account and then going to the ECS service page or just hitting ECS directly? If the former, could you try visiting the ECS page without scanning and seeing if the problem persists? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

iann0036 commented 3 years ago

Just to confirm, going direct to ECS without a full scan did work? If so, I'll go looking through that throttling issue.

mysnoopy commented 3 years ago

It didn’t work even I went direct to the ecs tab.

On Mar 9, 2021, 9:50 PM -0800, Ian Mckay notifications@github.com, wrote:

Just to confirm, going direct to ECS without a full scan did work? If so, I'll go looking through that throttling issue. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

iann0036 commented 3 years ago

Thanks for confirming. I've created a code block which should help narrow down the issue. Could you go to just the Former2 dashboard, then open a JavaScript Console and paste in the following:

console.log("Blocking the datatable");

blockUI('#section-containers-ecs-taskdefinitions-datatable');

console.log("About to list task defs");

await sdkcall("ECS", "listTaskDefinitions", {
    sort: "DESC"
}, true).then(async (data) => {
    console.log("Got task defs");
    console.log(data);

    $('#section-containers-ecs-taskdefinitions-datatable').deferredBootstrapTable('removeAll');

    console.log("About to gather ARNs");

    var baseTaskDefinitions = [];
    var taskDefinitionArns = [];
    data.taskDefinitionArns.forEach(taskDefinitionArn => {
        var baseTaskDefinition = taskDefinitionArn.split(":");
        baseTaskDefinition.pop();
        baseTaskDefinition = baseTaskDefinition.join(":");
        if (!baseTaskDefinitions.includes(baseTaskDefinition)) {
            baseTaskDefinitions.push(baseTaskDefinition);
            taskDefinitionArns.push(taskDefinitionArn);
        }
    });

    console.log("Gathered ARNs, about to start processing each task def");

    await Promise.all(taskDefinitionArns.map(taskDefinitionArn => {
        console.log("Processing " + taskDefinitionArn);

        return sdkcall("ECS", "describeTaskDefinition", {
            taskDefinition: taskDefinitionArn
        }, true).then((data) => {
            console.log("Got data for " + taskDefinitionArn);
            console.log(data);

            $('#section-containers-ecs-taskdefinitions-datatable').deferredBootstrapTable('append', [{
                f2id: data.taskDefinition.taskDefinitionArn,
                f2type: 'ecs.taskdefinition',
                f2data: data.taskDefinition,
                f2region: region,
                name: data.taskDefinition.family,
                networkmode: data.taskDefinition.networkMode,
                cpu: data.taskDefinition.cpu,
                memory: data.taskDefinition.memory
            }]);
        }).catch(err => {
            console.log("Caught a describe error");
            console.log(err);
        });
    }));
}).catch(err => {
    console.log("Caught a list error");
    console.log(err);
});

console.log("Unblocking the datatable");

unblockUI('#section-containers-ecs-taskdefinitions-datatable');

console.log("Done");

The resulting logs should tell the story.

mysnoopy commented 3 years ago

Here is what I got.

select2.full.min.js:3 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 setup @ select2.full.min.js:3 add @ jquery-3.2.1.min.js:3 (anonymous) @ jquery-3.2.1.min.js:3 each @ jquery-3.2.1.min.js:2 each @ jquery-3.2.1.min.js:2 ya @ jquery-3.2.1.min.js:3 on @ jquery-3.2.1.min.js:3 bind @ jquery-3.2.1.min.js:4 A @ ui-plugins.js:1 n @ ui-plugins.js:1 (anonymous) @ ui-plugins.js:1 jquery-3.2.1.min.js:3 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 add @ jquery-3.2.1.min.js:3 (anonymous) @ jquery-3.2.1.min.js:3 each @ jquery-3.2.1.min.js:2 each @ jquery-3.2.1.min.js:2 ya @ jquery-3.2.1.min.js:3 on @ jquery-3.2.1.min.js:3 bind @ jquery-3.2.1.min.js:4 E @ ui-plugins.js:1 n @ ui-plugins.js:1 (anonymous) @ ui-plugins.js:1 jquery-3.2.1.min.js:3 [Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 add @ jquery-3.2.1.min.js:3 (anonymous) @ jquery-3.2.1.min.js:3 each @ jquery-3.2.1.min.js:2 each @ jquery-3.2.1.min.js:2 ya @ jquery-3.2.1.min.js:3 on @ jquery-3.2.1.min.js:3 bind @ jquery-3.2.1.min.js:4 E @ ui-plugins.js:1 n @ ui-plugins.js:1 (anonymous) @ ui-plugins.js:1 onloadwff.js:71 [Violation] 'setTimeout' handler took 90ms onloadwff.js:71 [Violation] 'setTimeout' handler took 55ms onloadwff.js:71 [Violation] 'setTimeout' handler took 60ms

[image: Screen Shot 2021-03-09 at 11.37.08 PM.png]

On Tue, Mar 9, 2021 at 10:56 PM Ian Mckay notifications@github.com wrote:

Thanks for confirming. I've created a code block which should help narrow down the issue. Could you go to just the Former2 dashboard, then open a JavaScript Console and paste in the following:

console.log("Blocking the datatable");

blockUI('#section-containers-ecs-taskdefinitions-datatable');

console.log("About to list task defs");

await sdkcall("ECS", "listTaskDefinitions", { sort: "DESC" }, true).then(async (data) => { console.log("Got task defs"); console.log(data);

$('#section-containers-ecs-taskdefinitions-datatable').deferredBootstrapTable('removeAll');

console.log("About to gather ARNs");

var baseTaskDefinitions = [];
var taskDefinitionArns = [];
data.taskDefinitionArns.forEach(taskDefinitionArn => {
    var baseTaskDefinition = taskDefinitionArn.split(":");
    baseTaskDefinition.pop();
    baseTaskDefinition = baseTaskDefinition.join(":");
    if (!baseTaskDefinitions.includes(baseTaskDefinition)) {
        baseTaskDefinitions.push(baseTaskDefinition);
        taskDefinitionArns.push(taskDefinitionArn);
    }
});

console.log("Gathered ARNs, about to start processing each task def");

await Promise.all(taskDefinitionArns.map(taskDefinitionArn => {
    console.log("Processing " + taskDefinitionArn);

    return sdkcall("ECS", "describeTaskDefinition", {
        taskDefinition: taskDefinitionArn
    }, true).then((data) => {
        console.log("Got data for " + taskDefinitionArn);
        console.log(data);

        $('#section-containers-ecs-taskdefinitions-datatable').deferredBootstrapTable('append', [{
            f2id: data.taskDefinition.taskDefinitionArn,
            f2type: 'ecs.taskdefinition',
            f2data: data.taskDefinition,
            f2region: region,
            name: data.taskDefinition.family,
            networkmode: data.taskDefinition.networkMode,
            cpu: data.taskDefinition.cpu,
            memory: data.taskDefinition.memory
        }]);
    }).catch(err => {
        console.log("Caught a describe error");
        console.log(err);
    });
}));

}).catch(err => { console.log("Caught a list error"); console.log(err); });

console.log("Unblocking the datatable");

unblockUI('#section-containers-ecs-taskdefinitions-datatable');

console.log("Done");

The resulting logs should tell the story.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iann0036/former2/issues/155#issuecomment-794985510, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5NSGAFGSFJBXUFE2LNQ4TTC4JYLANCNFSM4Y2EFRCQ .

iann0036 commented 3 years ago

Hey @mysnoopy,

It looks like those aren't the logs I was expecting as a result (and the screenshot didn't come through via email replies). Could you try again by pasting that code into the JavaScript Console? I'd expect to at least get a Blocking the datatable log entry.

mysnoopy commented 3 years ago

I did paste your code to the JavaScript console. The output was copied from the output section on top of the console code. How can I send you my screenshot?

I will try do it again.

On Mar 9, 2021, 11:50 PM -0800, Ian Mckay notifications@github.com, wrote:

Hey @mysnoopy, It looks like those aren't the logs I was expecting as a result (and the screenshot didn't come through via email replies). Could you try again by pasting that code into the JavaScript Console? I'd expect to at least get a Blocking the datatable log entry. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

iann0036 commented 3 years ago

Sorry for the confusion!

The output will come after pasting the code, so below the code after you press Enter after pasting it in.

mysnoopy commented 3 years ago

Hum.. there was nothing came out after I pasted the code on console.

On Mar 10, 2021, 12:48 AM -0800, Ian Mckay notifications@github.com, wrote:

Sorry for the confusion! The output will come after pasting the code, so below the code after you press Enter after pasting it in. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

iann0036 commented 3 years ago

Would you be available for a quick screensharing session?

https://meet.google.com/jyo-twof-ctk

iann0036 commented 3 years ago

Looks like I missed you.

If you're happy to have a quick screensharing session in the future, let me know when a good time for you is. I'm in Sydney timezone.

mysnoopy commented 3 years ago

yea. I missed you as well. I am in the us west time soon. i will ping you in my last afternoon here.

thx

On Wed, Mar 10, 2021 at 1:29 AM Ian Mckay notifications@github.com wrote:

Looks like I missed you.

If you're happy to have a quick screensharing session in the future, let me know when a good time for you is. I'm in Sydney timezone.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iann0036/former2/issues/155#issuecomment-795146161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5NSGCG5OXI7GWNQFOGOV3TC43WBANCNFSM4Y2EFRCQ .

iann0036 commented 3 years ago

Sure, now is good: https://meet.google.com/jyo-twof-ctk

mysnoopy commented 3 years ago

hi.. per your suggestion, i tried the cli. seems like i am having a similar issue that i was expecting with the ui. nothing came back from the ecs cli command.

mysnoopy commented 3 years ago

Finally, I got the ECS list after I let the scan running for about 20 mins due to my super big/long ecs services tasks list However, I need to scan again after I refreshed my browser. Is it possible to cache the scan result on local memory or local disk, and add or remove the differences during rescan at the background?

iann0036 commented 3 years ago

Hey @mysnoopy,

Thanks for the update - that's very fascinating!

There currently isn't a way to cache results locally, but I'll take this up as a potential future feature. There are some security considerations for this I'll need to consider however. I'll also have to ponder potential improvements for the large account use-case - I assume you'd have similar issues in the AWS console?

mysnoopy commented 3 years ago

Yeah. I believe cli has the exact same problem. I pull the code and run a container on my local laptop. So I don’t worry about the security at this moment. However, you are right. There is a security concerns if the operation is running on public or share infrastructure. Looking forward to see the enhancement. On Mar 17, 2021, 1:05 AM -0700, Ian Mckay @.***>, wrote:

Hey @mysnoopy, Thanks for the update - that's very fascinating! There currently isn't a way to cache results locally, but I'll take this up as a potential future feature. There are some security considerations for this I'll need to consider however. I'll also have to ponder potential improvements for the large account use-case - I assume you'd have similar issues in the AWS console? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.