StrToMember MDX function causing a server crash

Post Reply
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

StrToMember MDX function causing a server crash

Post by PavoGa »

We have isolated a problem where StrToMember will cause a server crash. This may be a well known problem, but a cursory Google search did not reveal anything on it.

The code is building a subset of accounts based on values in a cube:

Code: Select all

GENERATE( FILTER( TM1SUBSETALL( [Account] ),
	LEN([mycube].([Version].[Active1], [Measure].[myMeasure])) > 0)
	, {StrToMember("[Account].[" + [mycube].([Version].[Active1], [Measure].[RollupAccount]) + "]")})
when the conditional returns a blank to the StrToMember function, the server crashes. Of course, we'll prevent that from happening henceforth, but if this has not been recognized, should it be considered a bug and reported? I think crashing the server is a bit of an extreme response to a bad argument to the MDX function.
Ty
Cleveland, TN
Drg
Regular Participant
Posts: 159
Joined: Fri Aug 12, 2016 10:02 am
OLAP Product: tm1
Version: 10.2.0 - 10.3.0
Excel Version: 2010

Re: StrToMember MDX function causing a server crash

Post by Drg »

you tried to put more curly braces???

Code: Select all

{GENERATE( {FILTER( TM1SUBSETALL( [Account] ),
	LEN([mycube].([Version].[Active1], [Measure].[myMeasure])) > 0)}
	, {StrToMember("[Account].[" + [mycube].([Version].[Active1], [Measure].[RollupAccount]) + "]")})}
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: StrToMember MDX function causing a server crash

Post by PavoGa »

Drg wrote: Tue May 07, 2019 12:25 pm you tried to put more curly braces???

Code: Select all

{GENERATE( {FILTER( TM1SUBSETALL( [Account] ),
	LEN([mycube].([Version].[Active1], [Measure].[myMeasure])) > 0)}
	, {StrToMember("[Account].[" + [mycube].([Version].[Active1], [Measure].[RollupAccount]) + "]")})}
Those are not necessary with functions that return a set to begin with. And the problem is occurs when the RollupAccount is blank for the filtered Account set. I would expect an error in this case (and modified the FILTER to avoid it), but think a server crash is a bit harsh. We'll report to IBM, although hopefully this is taken care of in one of the subsequent releases we do not have as of yet.

I did not see anything related to this when I googled it and wanted to put it out there for information.
Ty
Cleveland, TN
Drg
Regular Participant
Posts: 159
Joined: Fri Aug 12, 2016 10:02 am
OLAP Product: tm1
Version: 10.2.0 - 10.3.0
Excel Version: 2010

Re: StrToMember MDX function causing a server crash

Post by Drg »

Yes, the server crash is unacceptably cruel. But you can use the workaround using the union of two members and take only one upper one, then if the first one is empty, you can take the default one. But this is terrible in terms of finding bugs.
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: StrToMember MDX function causing a server crash

Post by PavoGa »

Drg wrote: Tue May 07, 2019 1:15 pm Yes, the server crash is unacceptably cruel. But you can use the workaround using the union of two members and take only one upper one, then if the first one is empty, you can take the default one. But this is terrible in terms of finding bugs.
I am responding to this to make sure anyone who sees does not get the wrong idea.

A UNION will not help this. In actuality, the full MDX statement in the TI uses a UNION (I use UNION in virtually all TI MDX for a couple of purposes). The problem is when the MDX submits a blank/null value to StrToMember. All the UNIONs in the world are not going to prevent that. The "workaround" (better described as preventative method) is a filter to prevent a null value hitting the StrToMember function.
Ty
Cleveland, TN
User avatar
Elessar
Community Contributor
Posts: 338
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

Re: StrToMember MDX function causing a server crash

Post by Elessar »

Hello,

IMHO this is a serious bug: any user can open Architect, write this MDX expression and crash the server.
I've already reported a similar bug: https://www-01.ibm.com/support/entdocvi ... wg1PH06648
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 6th article - PAfE + VBA: Commit each cell without pressing “Commit” button.
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: StrToMember MDX function causing a server crash

Post by PavoGa »

Elessar,

Have not looked at your link yet, but I do have an update. This also happens when a bad alias is handed to StrToMember. That should not have happened in our case, but we had a bad alias stored in a cube and, Whoa Nellie! it crashed the server while building a subset off that measure.
Ty
Cleveland, TN
Drg
Regular Participant
Posts: 159
Joined: Fri Aug 12, 2016 10:02 am
OLAP Product: tm1
Version: 10.2.0 - 10.3.0
Excel Version: 2010

Re: StrToMember MDX function causing a server crash

Post by Drg »

Fixit on PA local 2.0.7
Post Reply