# Perspective Memory Leak, pages not shutting down when tab closed

**URL:** <https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 22, 2025, 8:50pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257 "2025-01-22T20:50:43Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_Baker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jay_baker/32/35448_2.png) [@Jay\_Baker](https://forum.inductiveautomation.com/u/Jay_Baker)\
**Post date:** [January 22, 2025, 8:50pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/1 "2025-01-22T20:50:43Z")

</div>

I've got a memory leak issue in Ignition, where Ignition keeps a page running after you close the browser tab. This affects memory and processor on both the client and server, as (in this case) I've got data updating on a timer, so updates continue to happen indefinitely, as far as I can tell.

I've made a simplified example - essentially, a test view which just has a custom parameter bound to a five second timer, printing out the page id to the logs. This shows that the page remains running when the browser tab is closed.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/5/8596f4931dfe7dc4b60ba95baaf0d50f045d6924.png)

If I then open the page again in another tab, a second page id starts printing to the log, and so on, for as many times as I do this, until my computer starts to melt. In this shot, I have now Perspective tabs left open, and yet...

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/1/016a3635ca1044567526e8cc7faa54e22f74aaf5.png)

Note - pages DO seem to close correctly (and trigger the onShutdown event) if I navigate to another Perspective page instead of closing the tab.

So - am I doing something wrong here? Is there any way for these pages to detect that they are orphaned, and force themselves to shutdown?

Ignition v8.1.33. Browser, recent versions of both Chrome and Edge.

---

<div class="post-metadata">

**Author:** ![Jay\_Baker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jay_baker/32/35448_2.png) [@Jay\_Baker](https://forum.inductiveautomation.com/u/Jay_Baker)\
**Post date:** [January 24, 2025, 1:48am UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/2 "2025-01-24T01:48:46Z")

</div>

Update: this seems to happen even with pages with no timers, or refresh code, etc.

I've been logging the number of active pages in the session (sourced from system.perspective.getSessionInfo()), and once a page is created, it doesn't seem to go away until I manually kill the session (or, until the Trial Mode on my dev box times out after two hours).

I've also checked this on our production server - I opened a page in a new tab and then immeditately closed it, then repeated this a few times - and they never seem to close. The session is still there an hour later, with all the pages still active.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5ce984d6482f89d2ab7ec3b373acdc2632d5f99f.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/61b06d7f29defd694d3ca5ecef59ff5626e9d112.png)

---

<div class="post-metadata">

**Author:** ![Iggy\_the\_dog](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/iggy_the_dog/32/71890_2.png) [@Iggy\_the\_dog](https://forum.inductiveautomation.com/u/Iggy_the_dog)\
**Post date:** [January 24, 2025, 3:31am UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/3 "2025-01-24T03:31:01Z")

</div>

With the shutdown being called the session should be closing. I am curious if this occurs in the most recent version of Ignition? Also do you have a screenshot of the status\>performance page?

---

<div class="post-metadata">

**Author:** ![Jay\_Baker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jay_baker/32/35448_2.png) [@Jay\_Baker](https://forum.inductiveautomation.com/u/Jay_Baker)\
**Post date:** [January 27, 2025, 4:31am UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/4 "2025-01-27T04:31:49Z")

</div>

Yeah, it should be! But the shutdown only seems to get called when navigating to another perspective page, not when simply closing the browser tab. (I've got logging on the onShutdown event to check this).

I checked the status\>performance page as you suggested, and something does seem to be clearing out the memory, which is good (the memory clears down to a base amount and then rapidly climbs again, before being cleared again). So maybe I'm needlessly worrying about it. Although, the timed scripts all seem to still be running (as seen in the logs), which really doesn't seem right.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 27, 2025, 12:04pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/5 "2025-01-27T12:04:54Z")

</div>

Not sure if it's relavent, but What are your session time outs set to?

> **[Perspective Project Properties | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/perspective-project-properties)**
>
> There are a number of properties you can set for your Perspective projects within the Designer. For example, there are properties for setting security levels, configuring how the sessions receive updates, and more.

---

<div class="post-metadata">

**Author:** ![Jay\_Baker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jay_baker/32/35448_2.png) [@Jay\_Baker](https://forum.inductiveautomation.com/u/Jay_Baker)\
**Post date:** [January 27, 2025, 8:57pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/6 "2025-01-27T20:57:54Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/c/3c0073fb4d69d068f93bd888b2260fe2ce28206a.png)

So, that's a pretty long timeout. I'll try reducing it and see if that fixes my problem.

Still doesn't really explain why individual pages within the session still keep running when their tab is closed, though...

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 27, 2025, 9:58pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/7 "2025-01-27T21:58:24Z")

</div>

I don't think closing a tab sends anything through to the gateway, so the session doesn't know it's closed until the timeout. I could be wrong though

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 27, 2025, 10:06pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/8 "2025-01-27T22:06:22Z")

</div>

> [@Jay\_Baker](#):
>
> Still doesn't really explain why individual pages within the session still keep running when their tab is closed, though...

> [@nminchin](#):
>
> I don't think closing a tab sends anything through to the gateway, so the session doesn't know it's closed until the timeout.

Asked, answered, I think. Guess I should probably consult with somebody who knows better 😬

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 27, 2025, 11:43pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/9 "2025-01-27T23:43:32Z")

</div>

> [@nminchin](#):
>
> I don't think closing a tab sends anything through to the gateway, so the session doesn't know it's closed until the timeout. I could be wrong though

More explicitly:  
There is _no way_ to distinguish, on the backend, between "the user closed the tab explicitly" and "the user's network connection dropped out". So if you give your sessions long timeouts, be aware that you're keeping a _potentially_ heavy gateway resource around for a long time.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 28, 2025, 12:14am UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/10 "2025-01-28T00:14:45Z")

</div>

Just to clarify, sessions hold page ids, and page ids that are closed by the user by closing a tab are not released until the session timeout expires and there's been no keep alive sent for that page id?

---

<div class="post-metadata">

**Author:** ![Jay\_Baker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jay_baker/32/35448_2.png) [@Jay\_Baker](https://forum.inductiveautomation.com/u/Jay_Baker)\
**Post date:** [January 28, 2025, 12:29am UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/11 "2025-01-28T00:29:01Z")

</div>

Right...shouldn't it be possible to detect that the session is still connected (because it is still talking to the server, and therefore the network connection is still up), but a particular page within that session has closed?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 28, 2025, 4:59am UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/12 "2025-01-28T04:59:11Z")

</div>

Browsers isolate tabs from each other.

---

<div class="post-metadata">

**Author:** ![Eric\_White](https://avatars.discourse-cdn.com/v4/letter/e/85e7bf/32.png) [@Eric\_White](https://forum.inductiveautomation.com/u/Eric_White)\
**Post date:** [February 16, 2025, 11:10pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/13 "2025-02-16T23:10:28Z")

</div>

Is there a way to know if the page/tab timeout is actively counting?  
(I assume its always counting up because general network comms etc, but an earlier indicator)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 18, 2025, 3:33pm UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/14 "2025-02-18T15:33:43Z")

</div>

There's a `lastActivity` session property:

> **[Session Properties | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/perspective-sessions/session-properties#session-properties-table)**
>
> Session properties are available for use throughout Perspective Sessions. Sessions of a given project will have the same list of properties, however, the actual values are unique and independent for each running Session.

---

<div class="post-metadata">

**Author:** ![Amitkumar\_Ravat1](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@Amitkumar\_Ravat1](https://forum.inductiveautomation.com/u/Amitkumar_Ravat1)\
**Post date:** [June 25, 2025, 8:16am UTC](https://forum.inductiveautomation.com/t/perspective-memory-leak-pages-not-shutting-down-when-tab-closed/101257/15 "2025-06-25T08:16:05Z")

</div>

I am also facing similar issue on a view and here we don't have timeout. Every time i have to restart gateway to fix it. And I am getting this warning message on PROD server, and I am not able to replicate it. Opening duplicate view on same browser is causing this, i Guess. and after closing the tab also this closed tab keeps running scripts.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/8/2814fad3c7fd7a3e9173872f1ca12f4bbcbf1975.jpeg)  
Ignition v8.1.33.
