PDA

View Full Version : Too many instances


tom kirkman
04-16-2003, 11:35 AM
I am using WM 11.50 with OSDM 11.5 on windows nt 4.0. Periodically I get an error "Too Many Instances" when saving a part, or a drawing.

Has anyone else experienced this? Any ideas as to what customization I can look for that causes this problem?

Thanks

Tom Kirkman

ChrisE
04-17-2003, 02:46 AM
Does the error message come from WorkManager?

What does the full message say (click on the error message to display it's full length) ?

Maybe too many cache instances ?

tom kirkman
04-17-2003, 05:21 AM
The error is from workmanager. I have attached a copy of the error window. It does not specifically mention cache.

Thanks

Tom

ChrisE
04-22-2003, 12:45 AM
Hi Tom,

hope you had a pleasant easter weekend :)

Although the word "cache" is not mentioned, it looks very much like a cache problem to me.

A cache is a temporary space in the WM session, where an element from the database is loaded into for either reading, modifying, or deleting.

If the same element gets read into cache too often, you might get such a message.

So please check your customization for areas where an element gets read into cache (mostly for reading attribute information), but never gets dropped out of the cache memory.

Look for combinations of the following commands:
Ui_select_element / Ui_drop_element
Ui_select_element / Ui_apply_element
DMS_SELECT_ELEMENT / DMS_DROP
DMS_SELECT_ELEMENT / DMS_APPLY
It is likely that the drop-/apply-commands are missing.

This might apply to other WM specific elements as well, like e.g. the current user or group, so there are also commands like DMS_SELECT_USER or DMS_SELECT_GROUP to check for.

Also, make sure to use proper cache cleanup handling, like e.g.

LET num_cleanups Dms_get_num_cleanups
Ui_select_element VIEW l_doc_elid
LET l_cid Dms_return_val
LET l_name (GET_CACHE_VALUE l_cid Db_default_name)
Ui_drop_element l_cid
Dms_clear_cleanups_to num_cleanups


Chris :cool:

Fred RINCE
04-22-2003, 12:56 AM
Probably, you have used open command for read/modification on this element, too many time. (up to 16 times). Cache logical table on this element is full. Perhaps a problem in your macro comand, or in your clean cash ?

MPalicki
04-22-2003, 04:33 AM
Thanks for the replies (I work with Tom). I think we have found the offending portion of our customizations. Anybody ambitous enough to analyze this for us and help us correct it?


DEFINE Awmc_2d3d_i_create_link_elem
{---------------------------------------------------------------------------}
{---------------------------------------------------------------------------}
PARAMETER Doc_elid
LOCAL Num_errors
LOCAL Ok
LOCAL Pkelid
LOCAL Pkcid
LOCAL Cid
LOCAL Elid
LOCAL Rcid
LOCAL Ret
LOCAL Index
LOCAL Max_wait
LET Max_wait 20
LET Ok 1
CREATE_LTAB "notes__pkt__ltab"
SQL_QUERY ("SELECT "+Db_elid+" FROM "+Dbr_elements+" WHERE "+
Db_unique_id_string+" = '"+Db_notes_packet+"'") USER_TABLE
"notes__pkt__ltab"
END
LET Pkelid (READ_LTAB "notes__pkt__ltab" 1 1)
LET Num_errors Dms_get_num_errors
LET Index 0
LOOP
LET Pkcid (DMS_SELECT_ELEMENT UPDATE Pkelid)
EXIT_IF ((Pkcid!=ERROR) OR (Index==Max_wait))
IF (Index==0)
Awm_ed_m_display_prompt (GET_CURRENT_WINDOW) (CATGETS "awm.cat" 1024
"Please wait, USER_TABLE is being used by another user!")
END_IF
IF (Index<12)
WAIT 0
ELSE
WAIT 1
END_IF
LET Index (Index+1)
END_LOOP
IF (Pkcid!=ERROR)
Dms_clear_errors Num_errors
ELSE_IF (Index>1)
Dms_clear_errors (Num_errors+1)
END_IF
IF ((TYPE Pkcid)!=STRING)
LET Ok 0
END_IF
IF (Ok)
LET Cid (DMS_CREATE_ELEMENT Awmc_val_2d3d_general)
IF ((TYPE Cid)!=STRING)
LET Ok 0
END_IF
END_IF
IF (Ok)
LET Elid
Dms_filter_errors (GET_CACHE_VALUE Cid Db_elid)
LET Rcid (DMS_ADD_TO_ELEMENT_SET Pkcid Elid MASTER)
LET Num_errors Dms_get_num_errors
LET Ret (SET_CACHE_VALUE Cid Db_default_name "2D-3D LINK")
IF (Ret!=NO_ERROR)
END
Dms_clear_errors Num_errors
END_IF
LET Ret (DMS_APPLY RETAIN Cid)
IF (Ret!=NO_ERROR)
LET Ret (DMS_DELETE_FROM_ELEMENT_SET Rcid)
LET Ret (DMS_DROP Cid)
LET Ok 0
END_IF
LET Ret (DMS_APPLY FLUSH Pkcid)
ELSE_IF ((TYPE Pkcid)==STRING)
LET Ret (DMS_DROP Pkcid)
END_IF
IF (Ok)
IF ((DMS_GET_SCHEMA_VERSION)<8)
LET Rcid (DMS_ADD_ELE_RELATION Cid Doc_elid)
ELSE
Lct_get_2d3d_link_class_type Cid Elid
Lct_get_2d3d_link_class Cid Doc_elid Anno_2d3d_link_class_type
Check_linkclass_in_linkclasstype Anno_2d3d_link_class_type
Anno_2d3d_link_class
IF (Dms_return_val==1)
LET Rcid
Dms_filter_errors (DMS_ADD_LINK Cid Doc_elid Anno_2d3d_link_class)
ELSE
LET Rcid 0
END_IF
END_IF
IF (Rcid==0)
LET Ret (DMS_DELETE Cid)
LET Ret (DMS_APPLY FLUSH Cid)
LET Ok 0
END_IF
END_IF
IF (Ok)
LET Ret (SET_CACHE_VALUE Rcid Db_view_name Awm_2d3d_val_ltype_drawing)
LET Ret (SET_CACHE_VALUE Cid Db_state Awm_2d3d_state_valid)
LET Ret (DMS_APPLY RETAIN Cid)
IF (Ret!=NO_ERROR)
LET Ret (DMS_DELETE Cid)
LET Ret (DMS_APPLY FLUSH Cid)
LET Ok 0
END_IF
END_IF
IF (Ok)
LET Dms_return_val Cid
ELSE
LET Dms_return_val ERROR
END_IF
END_DEFINE

Fred RINCE
04-22-2003, 05:38 AM
I suppose your problem appears when you test your macro ? If an error occurs in your process, the cacheid of your paquet stay open in modification state. To avoid this, you may use cleanups functions. (dms_push_cleanup; dms_clear_cleanups_to and so on)
So, if you use ui_xxxx command, it's easier, because some of them have already "cleanups" inside. Be carreful. By this way, you'll use triggers.
Another way is to use toggle_packet_policy. In this case, you could create an element without any paquets. (toggle_packet_policy is a switch command).
If you want make a secure transaction, you maight use trans_begin, trans_apply and trans_end command.

You have many choici to change your code

ChrisE
04-22-2003, 06:29 AM
I doubt this is your point of problem, because the macro looks pretty much original (except for the line where the NAME attribute of the new element is being set (line 58)

If this macro was in error, a lot of customers would have the same problem.

Maybe you should contact CoCreate support, and have them analyze a trace of your session.

MPalicki
04-22-2003, 06:33 AM
Tried CoCreate; They deferred to the Partner who did the customization. It's been 7 weeks since I sent said partner a copy of our trace logs so he could analyze the problem.

:mad:

ChrisE
04-22-2003, 06:36 AM
Yes, TOGGLE_PACKET_POLICY would avoid two major problems:
- situation where two people at the same time try to open the notes packet
- SLOW performance for larger installations with many 2D3D-link elements and notes
(I'd rather setup a different packet for the 2D3D-link elements)

If you were to use TOGGLE_PACKET_POLICY, then you would also have to modify the macros where the 2D3D-link elements get modified (e.g. setting the state to invalid as in Awm_2d3d_m_invalidate_links)

I don't see the reason why this macro got "customized" - the SET_CACHE_VALUE to the NAME attribute works in both ways (unless the Db_default_name macro got modified, or the message catalog manipulated)

ChrisE
04-22-2003, 06:39 AM
Send me a copy of the trace so I get an idea at what point WM freaks out.

Maybe we have a chance ... (if it won't take me too long to analyze it - I'm not on the CoCreate pay roll ;) )

MPalicki
04-22-2003, 06:50 AM
attached....

Thanks!

ChrisE
04-22-2003, 07:01 AM
Originally posted by MPalicki
attached....

Thanks!

:confused: Where :confused:

MPalicki
04-22-2003, 07:04 AM
Try again....

MPalicki
04-22-2003, 07:07 AM
:mad:

Friggin !@#%!#$!

Ok, attaching the trace.txt fle doesn't seem to want to go.

Anybody got any other suggestions?

ChrisE
04-22-2003, 07:12 AM
Because it exceeds the allowed size.

Zip it, and check the file size. But it must be below 102400

I'll send you a private message with a link to my eMail address. So you can use your regular mail to program to send me the ZIPPED file.

ChrisE
04-22-2003, 07:26 AM
Almost knew it (DMS_SELECT_USER) :D

Extract from trace:

END_IF Awmc_display_user_full_name Awm_display_user_full_name
LET User_name ( DMS_USER_NAME ) "fly-7852"
LET Cid Dms_filter_errors ( DMS_SELECT_USER VIEW User_name "fly-7852" )
{ERROR: ***ERROR: too many instances for 'f0100089'}


The macro in error was not attached to your mail.

Make sure to do a DMS_DROP of the CID
(or send me the macro so I'll get it fixed for you)

MPalicki
04-22-2003, 07:29 AM
Not sure if I know which macro is in reference. (I'm new to the WM Administration) Be glad to send it if I can figure out which one it is.

ChrisE
04-22-2003, 07:30 AM
For some akward reason, the editor window is not existent, so the macro Awmc_ed_m_check_editor_win calls the macro Awmc_ed_m_init_editor, which display the full user name in the title bar.
The version of Awm_display_user_full_name I got is perfectly dropping the cache.

ChrisE
04-22-2003, 07:37 AM
By the way, the customizations done in the macros regarding the 2D3D-link are fine (done by Jeff Crowe), so he is not to blame.

I've seen many inputs like:
input '\\gcntcad2\sd\O-I_customization\WMcustom\...

How about using
- a SEARCH path
- a global variable (preset by an environment variable)
Would mean less hassle when moving the server or path layout around ;)

ChrisE
04-23-2003, 04:53 AM
Matthew & Tom,

I attached a file for you. It works around your problem of too many instances to a user cache. But I still haven't found the cause for that problem.

The patch first drops all still open cache entries of the current user, then calls the macro to display the user name in the editor window.

Hope this helps.

MPalicki
04-25-2003, 05:04 AM
Chris,
You've been a big help, and I'm sorry to be such a bother. But we're not really sure where we should be loading this file you created for us?

ChrisE
04-28-2003, 12:27 AM
Matthew,

the trace you sent me shows that the client uses WM 11.6.
The macros you sent via SAVE_MACRO came from a WM 11.5

So please sort out why there is a difference. As soon as this is done,
load this file via INPUT "..." in your ui_cust.m
The user cache problem should then be worked-around.

Chris