cancel
Showing results for 
Search instead for 
Did you mean: 

How to free unused extended memory?

benoit-schmid
Contributor
0 Kudos

Hello,

I have one user that has used lots of em.

This has caused priv mode to several wps due to a shortage of em.

The user has been disconnected from SAP from sm04 transaction.

There is no lock or update for this user in sm12/sm13.

Unfortunately the em has not been released to the system.

If I check in st02, the current usage is around 80%.

If I do st02 -> Extended Memory -> Mode list, I still see a big em usage

for this user that is not connected any more.

How can we release this em to SAP?

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I am with Rishi Abrol here.
What you are describing looks like a memory leak caused by a kernel bug.
This bug may have been fixed by now.
And in case you open an OSS call, I bet SAP's first suggestion will be a kernel upgrade...

regards

benoit-schmid
Contributor
0 Kudos

Hello,


Josef Bodenschatz wrote:


And in case you open an OSS call, I bet SAP's first suggestion will be a kernel upgrade...

I will try that.

Then what will be the second suggestion? 🙂

Regards,

benoit-schmid
Contributor
0 Kudos

Hello,


Josef Bodenschatz wrote:

I am with Rishi Abrol here.
What you are describing looks like a memory leak caused by a kernel bug.
This bug may have been fixed by now.
And in case you open an OSS call, I bet SAP's first suggestion will be a kernel upgrade...

regards

I have started to update the kernel in my landscape (latest disp+work).

Do you agree that the memory allocated for a user should be given back when it disconnects?

Must the sum of all EM used listed non history in mode list be equal to the total used em?

Regards,

Former Member
0 Kudos

Benoît Schmid wrote:

Do you agree that the memory allocated for a user should be given back when it disconnects?

Well, in theory memory should be given back when the user disconnects.

Here the term 'memory leak' comes in. It is a well known 'feature'.


Often an operating system process will not do what the programmer intended.
It may be the programmer's fault, or may be coming from a deeper layer, compiler or operating system.
Anyway, as soon as a programmer has been notified, it will be his task to correct the problem with the next version of his program.


And that's why I would just try a more recent kernel.

regards

benoit-schmid
Contributor
0 Kudos

Hello,


Josef Bodenschatz wrote:

I am with Rishi Abrol here.
What you are describing looks like a memory leak caused by a kernel bug.
This bug may have been fixed by now.
And in case you open an OSS call, I bet SAP's first suggestion will be a kernel upgrade...

regards

SAP OSS has confirmed that it is the memory leak kernel bug described in Note 1811596.

I have upgraded the kernel.

regards,

Answers (4)

Answers (4)

Reagan
Advisor
Advisor
0 Kudos

Memory related issues are always addressed in all the kernel patch levels.

In order to prevent such situations I would consider restricting the EM usage by a user than allocating a huge chink of memory per user context.

Regards

RB

benoit-schmid
Contributor
0 Kudos

Hello,


Reagan Benjamin wrote:

In order to prevent such situations I would consider restricting the EM usage by a user than allocating a huge chink of memory per user context.

Do you mean lowering the ztta/roll_extension to something like 1 GB?

Regards,

Reagan
Advisor
Advisor
0 Kudos

Correct.

Regards

RB

Reagan
Advisor
Advisor
0 Kudos

Go to ST02 - Extended Memory - Ext.Memory Block

Do you see the user and the memory used by the user here ?

If yes then check the status of the work process number mentioned here.

If the work process is still in PRIV status (which I doubt) then restart the WP.

Else you must be seeing the snapshot taken at an earlier taken by the system.

Regards

RB

benoit-schmid
Contributor
0 Kudos

Hello,


Reagan Benjamin wrote:

Go to ST02 - Extended Memory - Ext.Memory Block

Do you see the user and the memory used by the user here ?

If yes then check the status of the work process number mentioned here.

If the work process is still in PRIV status (which I doubt) then restart the WP.

Else you must be seeing the snapshot taken at an earlier taken by the system.

Regards

RB

No there is no line related to this user.

In the history (st02->extended memory->Mode LIst),

there is a line reporting a big em usage for this user.

Then how should I proceed to release the associated shared mem?

Regards,

Reagan
Advisor
Advisor
0 Kudos

Hello Benoit


No there is no line related to this user.

In the history (st02->extended memory->Mode LIst),

The history section doesn't provide the current usage.

Check the EM used under Tx ST02 - Detail Analysis Menu - SAP memory (Hit Enter to refresh)

If you still find that the memory is not released back to the OS then check this.

Release of SAP Memory for the Operating System - SAP Memory Management (BC-CST-MM) - SAP Library

Regards

RB

benoit-schmid
Contributor
0 Kudos

Hello Benjamin,


Reagan Benjamin wrote:

If you still find that the memory is not released back to the OS then check this.

Release of SAP Memory for the Operating System - SAP Memory Management (BC-CST-MM) - SAP Library

Yes I still see that the used extended memory is much higher than it should.

But my problem is not releasing to the OS.

My problem is to release for SAP.

Do you agree?

When you start SAP an IPC shared memory is created.

Our OS memory has been tuned to allow the em maximum usage.

Therefore the em is not a problem for the OS:

This is why I am insisting on the fact I that want to release memory for SAP wp and not for the OS.

You can have 1 TB of memory in the OS. If the em is limited to 2GB, SAP suffers when the em

reaches 2 GB even if there is plenty of OS memory.

Therefore I am asking again.

Why is this unused em memory not released for SAP?

How can we force the release for SAP.

Regards,

Former Member
0 Kudos

Hi,


You can have 1 TB of memory in the OS. If the em is limited to 2GB, SAP suffers when the em

reaches 2 GB even if there is plenty of OS memory.

As a temporary fix why dont you try to increase the em/initial_size_MB so that you dont have any error.

Can you please tell the kernel release...hope that this is not a kernel bug...

If you cant see the memory allocated in st02 and sm04 it should release.

Thanks

Rishi Abrol

benoit-schmid
Contributor
0 Kudos

Hello,


Rishi Abrol wrote:

As a temporary fix why dont you try to increase the em/initial_size_MB so that you dont have any error.

Can you please tell the kernel release...hope that this is not a kernel bug...

First, Increasing the em can only be done if you restart SAP.

This is why I do not want to simply increase it.

Second, even if I double em, I will get a user that will find

a way to use all the em with a badly used transaction.

Therefore it is definitively not the solution.

The kernel version is the following

kernel release                720
kernel make variant           720_EXT_REL
DBMS client library           OCI_112,                       
DBSL shared library version   720.00
compiled on                   SunOS 5.10 Generic_141444-09 sun4us for sun_64
compiled for                  64 BIT
compilation mode              Non-Unicode
compile time                  Jan 15 2013 20:11:57
update level                  0
patch number                  401

Regards,

Former Member
0 Kudos

Hi,

As the kernel looks to be 401 and we have kernel 520 also release. So can only suggest you to go to the latest kernel or check the below note for the memory fixes in the new kernel.

( 0.410) RTM: fix memory leak (note 1780685)

( 0.423) Memory leak in JSON writer (note 1841815)

( 0.434) Memory leak block id ID DIAGTC (note 1875862)

( 0.435) ABAP debugger: memory analysis bugfix internal tables (note 1879201)

( 0.513) New saposcol shared memory locking (note 1915533)

( 0.513) New saposcol shared memory locking (note 1915533)

( 0.518) DP: Potential Memory Overwrite (note 1937007)

( 0.519) DP: consistency check when attaching to shared memory (note 1942444)

( 0.519) Wrong memory values in SM50 and SM66 (note 1933885)

Thanks

Rishi Abrol

Reagan
Advisor
Advisor
0 Kudos

Hello Benoit

In that case I would list the top memory consuming work processes running under sidadm user and restart them from Tx SM50 and see if that helps.

Regards

RB

benoit-schmid
Contributor
0 Kudos

Hello,


Reagan Benjamin wrote:

Hello Benoit

In that case I would list the top memory consuming work processes running under sidadm user and restart them from Tx SM50 and see if that helps.

Regards

RB

Do you agree that only the dialog work processes and not all work processes should be restarted?

Do you agree that it is not a good idea to restart the enqueue wp in a productive system?

Are you sure that you solve my problem?

Regards,

Reagan
Advisor
Advisor
0 Kudos

Do you agree that only the dialog work processes and not all work processes should be restarted?

Yes. That is the one used by the users when the login to SAP to have the system memory for lunch


Do you agree that it is not a good idea to restart the enqueue wp in a productive system?

You only need to bother about the dialog ones.


Are you sure that you solve my problem?

Have worked for me. Prior to that check the top memory consuming processes at the OS level.

ps -elf | sort -k 10n | tail -5

The above command will list the top 5 memory consuming processes. If you have better ones then you can use.

Regards

RB

Former Member
0 Kudos

Benoît Schmid wrote:

Why is this unused em memory not released for SAP?

How can we force the release for SAP.

The allocation of extended memory in user context is occured at session startup. The size of allocated memory is varied during transaction startup/execution for this session and released after session has been finished. You can check this through ST02 -> Extended memory -> Mode list. Can you provide screenshots with your issue?

benoit-schmid
Contributor
0 Kudos

Roman N wrote:

The size of allocated memory is varied during transaction startup/execution for this session and released after session has been finished. You can check this through ST02 -> Extended memory -> Mode list. Can you provide screenshots with your issue?

Hello,

In our case the used extended memory reported by st02 is higher than

the sum of the extended memories reported in st02/mode list.

Do we agree that these should be identical?

Thanks in advance for your answers.

Former Member
0 Kudos

Benoît Schmid wrote:


In our case the used extended memory reported by st02 is higher than

the sum of the extended memories reported in st02/mode list.

Do we agree that these should be identical?

The same in our case also. More likely SAP extended memory contains something else in addition to user contexts. To answer on your initial question please describe in details all steps performed to analyze issue (if possible with screenshots).

benoit-schmid
Contributor
0 Kudos

Hello Roman,


Roman N wrote:

Benoît Schmid wrote:


In our case the used extended memory reported by st02 is higher than

the sum of the extended memories reported in st02/mode list.

Do we agree that these should be identical?

The same in our case also. More likely SAP extended memory contains something else in addition to user contexts. To answer on your initial question please describe in details all steps performed to analyze issue (if possible with screenshots).

1. What else is content in em?

2.This the description of my problem.

A specific user has eaten lots of em.

I could see it st02 mode list (historical value).

If we look at mode list current value, it sums to something like 1-1.5 GB.

But the overall em used is close to 4 GB.

Where are these 2.5 GB of em used?

Is my statement clearer?

Regards,

Former Member
0 Kudos

Hi,

Can you please go in SM04 and then click on goto ---> Memory and see if you can still see the memory related to that user.

Can you check the memory used in there.

Thanks

Rishi Abrol

benoit-schmid
Contributor
0 Kudos

Hello,


Rishi Abrol wrote:

Hi,

Can you please go in SM04 and then click on goto ---> Memory and see if you can still see the memory related to that user.

Can you check the memory used in there.

Thanks

Rishi Abrol

After disconnecting the user, it was not present.

Now that that he has reconnected sm04 shows 81 MB instead of the several GB reserved by him....

Regards,

benoit-schmid
Contributor
0 Kudos

Hello,


Rishi Abrol wrote:

Hi,

Can you please go in SM04 and then click on goto ---> Memory and see if you can still see the memory related to that user.

Can you check the memory used in there.

Thanks

Rishi Abrol

This reports 81 MB.

Regards,

Former Member
0 Kudos

Hello,

I found out two possible ways to solve this problem.

1) Try to set up autologout parameter (should be rdisp/gui_auto_logout) in seconds. When the user is automaticaly logged out, it should free the assigned memory.

2) Try to set up autorestart parameter for work processes (rdisp/wp_auto_restart). This should free the memory, which is locked by a user (and word process) which is in fact used at that moment.

The reason of not releasing this memory could be, that the process come to PRIV_MODE. So preventing this could also help. But this is mainly developers work I think.

Kind regards

benoit-schmid
Contributor
0 Kudos

Hello,


Kamil Veselý wrote:

1) Try to set up autologout parameter (should be rdisp/gui_auto_logout) in seconds. When the user is automaticaly logged out, it should free the assigned memory.


Do you agree that it is useless because even the user is logged out, the em is not released by SAP?

Regards,

benoit-schmid
Contributor
0 Kudos

Hello,


Kamil Veselý wrote:

2) Try to set up autorestart parameter for work processes (rdisp/wp_auto_restart). This should free the memory, which is locked by a user (and word process) which is in fact used at that moment.

To be sure that it is usefull, I would like to first manually restart the concerned wp.

How can I find out which wp has allocated this em for a specific user?

Thanks in advance for your answers.

Former Member
0 Kudos

Hi

Are you able to see any sessions under the user ID in SM66

Thanks

Rishi

Former Member
0 Kudos

Well, if the case of not used allocated extended memory is only with users already logged off, then I agree. But probably there could be some cases, when user is logged in and not using any extended memory at all. Also maybe you have the autologout parameter already set.

Former Member
0 Kudos

I think you can see it under ST02 - doubleclick Extended memory in the table below - Ext. memory blocks - WPID should be work process ID. But I am not sure, if the memory locked by a logged off user will be mentioned there, hopefully yes.

benoit-schmid
Contributor
0 Kudos

Hello,


Rishi Das wrote:

Hi

Are you able to see any sessions under the user ID in SM66

Thanks

Rishi


There is no session in sm66 for this user.

Regards,

benoit-schmid
Contributor
0 Kudos

Hello,


Kamil Veselý wrote:

I think you can see it under ST02 - doubleclick Extended memory in the table below - Ext. memory blocks - WPID should be work process ID. But I am not sure, if the memory locked by a logged off user will be mentioned there, hopefully yes.

As I have said.

There is no line concerning this user in this screen.

Regards,

Former Member
0 Kudos

Well, then for now I can only suggest to go restart work processes one by one and check after each if it helped or not. It could be long way if you have lot of DIA processes in the system, but it should lead to solution. Solution means, that automatic restarting of work processes would help.

benoit-schmid
Contributor
0 Kudos

Hello,


Kamil Veselý wrote:

Well, then for now I can only suggest to go restart work processes one by one and check after each if it helped or not. It could be long way if you have lot of DIA processes in the system, but it should lead to solution. Solution means, that automatic restarting of work processes would help.

Are you sure this would force the release of the memory?

Are you sure it is the only solution provided by sap?

Is it a good idea to restart the enqueue process in a productive environment?

Are you sure there is no risk by performing that?

Regards,

Former Member
0 Kudos

:c) Good questiones.

I am not sure with nothing. But anyway, these are only friendly advice, nothing official. I hope, this could help, because I know about some cases when it helped. But of course it is more save to check on test or quality system first.

If you want official help approved by SAP, you have better to make an OSS request (if you have access) and wait how they solve it.