ManyToOneNotSetException; objects getting lost in manytoone relationship?

11 views
Skip to first unread message

Brian G

unread,
May 18, 2008, 1:17:53 PM5/18/08
to transfer-dev
I have been seeing this behavior once in awhile over the past couple
of weeks since going live. Essentially the site is running along well
and good and suddenly a page will throw an exception. I upgraded to
the BER as of Friday (and I deleted all of my .transfer files) and
just got this error this morning:

In TransferObject 'event.event' manytoone 'club.club' does not exist.

* /var/www/pukka/api-prod/transfer/com/TransferObject.cfc (217,
CFTHROW)
* /var/www/pukka/api-prod/generated/event.event
$5283261E9899074FF5DEDEFA8FEA4E5D.transfer (979, CF_UDFMETHOD)
* /var/www/pukka/api-prod/generated/
event...@5283261E9899074FF5DEDEFA8FEA4E5D.transfer (243,
CF_TEMPLATEPROXY)
* /var/www/pukka/msr-prod/views/registration/dsp.ical.cfm (3,
CF_TEMPLATEPROXY)
* /var/www/pukka/api-prod/ModelGlue/unity/view/ViewRenderer.cfm
(29, CFINCLUDE)
* /var/www/pukka/api-prod/ModelGlue/unity/view/ViewRenderer.cfc
(50, CFMODULE)
* /var/www/pukka/api-prod/ModelGlue/unity/framework/ModelGlue.cfc
(450, CF_TEMPLATEPROXY)
* /var/www/pukka/api-prod/ModelGlue/unity/framework/ModelGlue.cfc
(340, CF_UDFMETHOD)
* /var/www/pukka/api-prod/ModelGlue/unity/framework/ModelGlue.cfc
(289, CF_UDFMETHOD)
* /var/www/pukka/api-prod/ModelGlue/unity/ModelGlue.cfm (126,
CF_TEMPLATEPROXY)
* /var/www/pukka/msr-prod/index.cfm (75, CFINCLUDE)

The XML here is very straightforward; it's just a basic manytoone:

<object name="event" table="tbllookupevent"
decorator="model.event.event">
<id name="uidevent" type="UUID" generate="true" />
<property name="vcheventname" type="string" />
...
<manytoone name="club" lazy="true">
<link column="uidclub" to="club.club" />
</manytoone>
</object>

club.club does not have any relationships to anything else. The line
of code that triggered this was trying to get the club from the event
object:

<cfset clb = viewState.getValue("objEvent").getClub() />

If I reload the page in question, it works again. I can't reproduce
it because as soon as it happens and throws an exception to the user,
it then seems to work on the next request (or as soon as I get my
exception report and test it myself) and the errors always come in
singles (never repeats).

Ideas?


Brian

Brian Kotek

unread,
May 18, 2008, 1:34:50 PM5/18/08
to transf...@googlegroups.com
Just to be sure, have you deleted all of your existing Transfer definition files?

Mark Mandel

unread,
May 18, 2008, 6:25:52 PM5/18/08
to transf...@googlegroups.com
Generally, this is an application error, in which a un-persisted object is returned from Transfer, as the ID you have asked for does not exist.

I'm going to guess you have a threading issue in your code somewhere.

Mark
--
E: mark....@gmail.com
W: www.compoundtheory.com

Brian G

unread,
May 19, 2008, 3:47:12 PM5/19/08
to transfer-dev

On May 18, 3:25 pm, "Mark Mandel" <mark.man...@gmail.com> wrote:
> I'm going to guess you have a threading issue in your code somewhere.
>

That's where I have seen it in the past but this is something else.

The object in question has been public on the site for weeks. This is
a public read-only view rather than an editing view, and the very next
request the composited object is once again available.

Brian K - yes, I deleted all of my .transfer files.

This happens after the application has been running for some time.
However, I'm running with 1GB of free RAM most of the time so I don't
think things should be falling out of the cache. I have default
caching enabled - no settings in the transfer.xml file.


Brian

Brian Kotek

unread,
May 19, 2008, 4:14:38 PM5/19/08
to transf...@googlegroups.com
How much free RAM you have on the server doesn't affect the JVM's available memory, or what may or may not fall out of the cache. I'm still betting on a threading issue or something else going on in your code. Have you run your code through the VarScoper utility at RIAForge to attempt to identify any non var-scoped variables?

Brian G

unread,
May 19, 2008, 10:06:48 PM5/19/08
to transfer-dev

On May 19, 1:14 pm, "Brian Kotek" <brian...@gmail.com> wrote:
> How much free RAM you have on the server doesn't affect the JVM's available
> memory, or what may or may not fall out of the cache. I'm still betting on a
> threading issue or something else going on in your code. Have you run your
> code through the VarScoper utility at RIAForge to attempt to identify any
> non var-scoped variables?

I'm talking about the JVM. I've got metrics turned on and there's 1GB
of RAM available to the JVM. I just restarted CF but this is what I'm
talking about:

05/19 19:02:16 metrics Web threads (busy/total): 1/25 Sessions: 44
Total Memory=2010112 Free=1701571

Up until a few minutes ago I was running 1.6GB total heap but Mike
Brunt from Alagad gave me some tips so I'm trying them out. With
1.6GB total heap, the free number never really dropped below 1GB so
RAM is (apparently) not the issue.

I have run varscoper several times but not in the past two weeks.
I'll give it another go and see if anything turns up. These
situations are read-only... all together, this makes me doubt
threading.


Brian

Mark Mandel

unread,
May 19, 2008, 10:24:04 PM5/19/08
to transf...@googlegroups.com
Well, the parent object is stored as a instance variable in the CFC - so it doesn't go anywhere.

Once it's loaded, it's in the CFC, so it can't just magically disappear. (unless you have code that does remove() operations).

Usually I've seen this show up when the ID you are looking for is not what you expect it to be - particularly when passed from a URL.  I.e. it's not what you expect it to be, or it gets doubled up in the URL, resulting in multiple values, etc.

Mark

Brian G

unread,
May 20, 2008, 1:00:01 AM5/20/08
to transfer-dev

On May 19, 7:24 pm, "Mark Mandel" <mark.man...@gmail.com> wrote:
> Once it's loaded, it's in the CFC, so it can't just magically disappear.
> (unless you have code that does remove() operations).

None of those on any of these objects.

> Usually I've seen this show up when the ID you are looking for is not what
> you expect it to be - particularly when passed from a URL. I.e. it's not
> what you expect it to be, or it gets doubled up in the URL, resulting in
> multiple values, etc.

I'd be inclined to say this is the case except that my exception
reports send me the URL of the error complete with ID (pieced together
from CGI.* variables) and I can verify it's a legitimate URL.

Furthermore, before it ever tries to load the page, I have a verify
check that will redirect away from the URL unless the event persists
in the database.

Soooo... without saying it's impossible, it's "impossible". :)

The problem is, of course, I can't replicate it because it only
happens at random. It did however happen about an hour ago again.
The fun of production vs. staging... ?


Brian

Mark Mandel

unread,
May 20, 2008, 1:05:30 AM5/20/08
to transf...@googlegroups.com
If you really want to prove me wrong - log the object and id that is retrieved from your service layer / transfer, and see what the ID is, and if the object returned is persisted.

Mark

Mark Mandel

unread,
May 20, 2008, 3:42:08 AM5/20/08
to transf...@googlegroups.com
You know something... I've been reviewing the code off an on for the last couple of days to see if there is something that may have caused this... and you know what, you may not be crazy.

Looking at some of the gen'd code, I see the following:

<cffunction name="setCMemento" access="public" returntype="void" default="void" hint="set the state of composition manytoone 'C'" output="false">
<cfargument name="memento" type="struct" required="true" hint="the memento to set the state with">
<cfscript>
var composite = 0;
setCisLoaded(true);
if(StructIsEmpty(arguments.memento))
{
removeC();
}
else
{
composite = getComposite("abcmanytoone.C", arguments.memento, "id");
setC(composite);
}
</cfscript>
</cffunction>

Where I set the isLoaded value before I actually set the value of the object.

If you look at the getC() method:

<cffunction name="getC" access="public" returntype="transfer.com.TransferObject" default="transfer.com.TransferObject" hint="Accessor for C, abcmanytoone.C" output="false">
<cfscript>
if(NOT getCisLoaded())
{
loadC();
}
if(NOT structKeyExists(instance, "C"))
{
throw("ManyToOneNotSetException","A ManyToOne TransferObject has not been initialised.","In TransferObject 'abcmanytoone.A' manytoone 'abcmanytoone.C' does not exist.");
}
return instance.C;
</cfscript>
</cffunction>

If there was a concurrent method call that happened at the same time that the highlighted part was working.. you would get the error you saw....

I'll change the order on this, and do some testing, and upload a change to SVN later today, and you can give it a test run.

I was sure this was something in your application, but you know what, I've been wrong before, and I'll probably be wrong again ;o) Thanks for being persistent.

Mark

simon

unread,
May 20, 2008, 8:47:29 AM5/20/08
to transfer-dev
Guys,

I'm just reading this post as I have an issues with my site as well,
and it looks similar to the one being discussed here. I have my site
working perfectly locally, but when I uploaded it to my web host the
other day and I am getting one of two errors all the time now, The
first one is a CF timeout error message when transfer starts up, a
refresh later and that goes away but then i continually get on all
the pages that are pulling information via transfer

"A ManyToOne TransferObject has not been initialised.
In TransferObject 'job.job' manytoone 'business.business' is not set."

I'm not sure if it is related but the errors look similar, I haven't
got my transfer.xml here to show you the relationships I will add this
tonight if needed. I am using the the latest ver 1.0 release on this
host.

let me know if you need any more information.

Simon

Mark Mandel

unread,
May 20, 2008, 11:07:12 PM5/20/08
to transf...@googlegroups.com
I'm guessing you all would see the errors on compositions that would be lazy?

(I can't quite see how this state could occur otherwise).

Mark

Mark Mandel

unread,
May 21, 2008, 2:04:43 AM5/21/08
to transf...@googlegroups.com
All,

I've had some personal stuff come up today, so I haven't been able to jump on this as quick as I would have liked.

A bug has been entered at:
http://tracker.transfer-orm.com/issue.cfm?p=89977683-A728-9CD3-ABD9545A91734422&i=090D7D56-BB13-1CAF-C26B42C777E20905

I'm starting work on it now, if I don't get something in SVN today, I will do first thing tomorrow.

Mark

Mark Mandel

unread,
May 21, 2008, 3:32:48 AM5/21/08
to transf...@googlegroups.com
All,

I've implemented a fix for the code generation into SVN.  Please download, and test (don't forget to delete your .transfer files!).

It's passed all unit tests, but if anything is to go wrong, it may be a 500 stack overflow, or a ConcurrentModificationException.  I've tested these for every scenario I can think of, but figured I would give you guys a heads up in case one of these shows up.

Let me know how it goes.

Mark

Mark Mandel

unread,
May 27, 2008, 8:08:04 PM5/27/08
to transf...@googlegroups.com
I've not heard anything from anyone on this issue for the past week... is this still an issue, or can I close the ticket?

Mark

Brian G

unread,
May 28, 2008, 12:30:44 AM5/28/08
to transfer-dev
Mark,

I've had this in production now for about a week and I don't think
we've seen the error since. I'll chime back in if it recurs but I
think it's solved at this point - many thanks!


Brian

Mark Mandel

unread,
May 31, 2008, 9:55:44 PM5/31/08
to transf...@googlegroups.com
I closed this ticket yesterday, I think we can consider it solved.

Thanks for the informed bug reporting guys!

Mark
Reply all
Reply to author
Forward
0 new messages