Julian Tree | 1 Oct 06:34
Picon

date.js cause memory leak

Hi,

I have included the following lib http://www.datejs.com

It works great, except for when I change some code and reload a web page, then Rhino or Helma instance just keeps on running until it times out.  It takes up 180% cpu on my MacBook.  The code runs fine as long as I don't change thing, but as you guys can see this will not work.

Is this a bug in Rhino, Helma or something to do with date.js.  I know that that lib is stil in alpha and it is mostly for clientside, but one thing I like about helma is that I will be able to use clientside js lib on serverside as well.  Please let me know if there are any work around. Thanks.

Julian
_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user
Julian Tree | 1 Oct 07:30
Picon

org.mozilla.javascript.NativeArray toJSON error

Sometimes when I have an object with arrays

I'm doing

if(!session.data.jobulousSurvey.Review.responses) session.data.jobulousSurvey.Review.responses = []

if I uneval.

uneval(session.data.jobulousSurvey.Review.responses)  // this is  end up to be org.mozilla.javascript.NativeArray

1. why is this happening?
2. this doesn't work with session.data.jobulousSurvey.Review.toJSON()

I don't really mind using a mozilla array, as long as I can use toJSON method on it.

Any recommendation or insight as why this is happening?  Is this a bug?

Julian
_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user
Rainer Rynesch | 1 Oct 09:21
Picon

Re: date.js cause memory leak

Hi,

We had the same problem, it's because datejs overwrites the toString() method (causing an infinte loop
when done twice) of the javascript Date prototype, as soon as you put the datejs within a condition there is
no problem in chaning code (but you can't change date.js)

if(!global.dateloaded){
  global.dateloaded = true;
... Date.js code ...
}


 
Rainer
 

> -----Ursprüngliche Nachricht-----
> Von: helma-user-bounces <at> helma.org 
> [mailto:helma-user-bounces <at> helma.org] Im Auftrag von Julian Tree
> Gesendet: Mittwoch, 01. Oktober 2008 06:34
> An: Helma User Mailing List
> Betreff: [Helma-user] date.js cause memory leak
> 
> Hi, 
> 
> I have included the following lib http://www.datejs.com

> 
> It works great, except for when I change some code and reload 
> a web page, then Rhino or Helma instance just keeps on 
> running until it times out.  It takes up 180% cpu on my 
> MacBook.  The code runs fine as long as I don't change thing, 
> but as you guys can see this will not work. 
> 
> Is this a bug in Rhino, Helma or something to do with 
> date.js.  I know that that lib is stil in alpha and it is 
> mostly for clientside, but one thing I like about helma is 
> that I will be able to use clientside js lib on serverside as 
> well.  Please let me know if there are any work around. Thanks.
> 
> Julian
> 
> 
_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user
Hannes Wallnoefer | 1 Oct 13:54
Picon
Gravatar

Re: org.mozilla.javascript.NativeArray toJSON error

Hi Julian,

my first guess would have been that the parent scope or prototype of the array are wrong or null, maybe because it has been serialized/deserialized or was created in another scope.

org.mozilla.javascript.NativeArray is indeed the class Rhino uses to implement javascript arrays, but you shouldn't see that when you do an uneval() or toSource().

Hannes

PS the helma mailing list has moved to http://groups.google.com/group/helma - I just haven't managed to turn the switch on the old list yet :-) So I'm cross-posting my answer to the new list.

2008/10/1 Julian Tree <julian.tree <at> gmail.com>
Sometimes when I have an object with arrays

I'm doing

if(!session.data.jobulousSurvey.Review.responses) session.data.jobulousSurvey.Review.responses = []

if I uneval.

uneval(session.data.jobulousSurvey.Review.responses)  // this is  end up to be org.mozilla.javascript.NativeArray

1. why is this happening?
2. this doesn't work with session.data.jobulousSurvey.Review.toJSON()

I don't really mind using a mozilla array, as long as I can use toJSON method on it.

Any recommendation or insight as why this is happening?  Is this a bug?

Julian

_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user


_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user
Patrick Lee | 14 Oct 00:24
Picon
Favicon

Standalone servlet helma.home

Hi,

I'm trying to set helma.home for helma running under tomcat. On
windows helma.home seems to be the System32 directory.

I've tried setting helma.home via -Dhelma.home passed in to tomcat but
Helma is not using that.

Any hints?
Picon

Re: Standalone servlet helma.home

Hi Patrick,

Having a quick look through the 1.6.2 src it looks like the helma.home
property is set, but not read by getInstallDir() in Main.java.
Looking at its code, looks like there are a number of places where the
location can come from:

- "-i" on the cmd line
- the jar url that the Main class is loaded from
- System.getProperty("user.dir")

https://dev.helma.org/trac/helma/browser/helma/helma/tags/helma_1_6_2/sr
c/helma/main/launcher/Main.java#L148

Maks.

> -----Original Message-----
> From: helma-user-bounces <at> helma.org 
> [mailto:helma-user-bounces <at> helma.org] On Behalf Of Patrick Lee
> Sent: Tuesday, 14 October 2008 09:25
> To: Helma User Mailing List
> Subject: [Helma-user] Standalone servlet helma.home
> 
> Hi,
> 
> I'm trying to set helma.home for helma running under tomcat. 
> On windows helma.home seems to be the System32 directory.
> 
> I've tried setting helma.home via -Dhelma.home passed in to 
> tomcat but Helma is not using that.
> 
> Any hints?
> _______________________________________________
> Helma-user mailing list
> Helma-user <at> helma.org
> http://helma.org/mailman/listinfo/helma-user
> 
kRAkEn/gORe | 14 Oct 09:09
Picon
Gravatar

improvements and questions.

Hi i've come into a series of problems with logging so far when mixing helma and
other libraries around (especially the apache commons). For example i'm using FOP
all the time for render PDF reports, and if you use FOP in debug mode there are chances to
get StackOverflows here and there. So the only way to disable FOP debugging in helma is to
modify the Logging LogFactory class this way.

keep track of a system (but better app.properties) variable that keeps which kind of classes
you need to disable:

    Vector disabledLoggers = new Vector ();
    String disabledClasses = System.getProperty("helma.disablelog", "");

    String[] disabled = disabledClasses.split (":");
    for (int i = 0; i < disabled.length; i++)
    {
        String disableTempClass = disabled[i].trim();
        if (disableTempClass.length () > 0)
            disabledLoggers.add (disableTempClass);
    }

then in public Log getInstance(String logname) we do:

    // normalize log name
    logname = logname.replaceAll("[^\\w\\d\\.]", "");

    for (int i = 0; i < disabledLoggers.size(); i++)
        if (logname.startsWith ((String) disabledLoggers.get (i)))
            return getNoLog();

and getNoLog is like this:

    // static global to the class no logger
    static NoOpLog noLog = new NoOpLog ();

    /**
     * Get a no logger
     * <at> return a logger that writes to Nirvana
     */
    public static Log getNoLog() {
        return noLog;
    }

----------------------------------------------------------------------

Anyway while browsing the Logging code i see the line in constructor:

    logdir = System.getProperty("helma.logdir", "log");

After doing some debugging, "helma.logdir" is set when Server starts from the server.properties logDir
property (if it isn't system wise), but actually server.properties is parsed AFTER the Logging class have
been initialized. So for instance we can have dicrepancies between the actual log directories and the
ones we have specified in the server.properties.


Let me know what u think

ps. Keep up the good work with HelmaNG !!!

Cheers,

Lucio





_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user
Juerg Lehni | 29 Oct 22:26

Re: __defineGetter__ for existing HopObject properties

Hi,

Almost a year later, here a patch that gets this to work.

http://helma.org/bugs/show_bug.cgi?id=647

With this in place, we can do neat things like adding support for  
watch / unwatch to HopObjects:

HopObject.prototype.watch = function(prop, handler) {
	this.__defineGetter__(prop, function() {
		this.unwatch(prop);
		var value = this[prop];
		this.watch(prop, handler);
		return value;
	});
	this.__defineSetter__(prop, function(value) {
		this.unwatch(prop);
		var ret = handler.call(this, prop, this[prop], value);
		if (ret !== undefined)
			value = ret;
		this[prop] = value;
		this.watch(prop, handler);
	});
}

HopObject.prototype.unwatch = function(prop) {
	delete this[prop];
}

I am curious to find out if this can make it into Helma 1.6.3 (or  
later).

Jürg

On 20 Nov 2007, at 18:10, Joshua Paine wrote:

> Walter Krivanek, VividVisions wrote:
>> I can't use __defineGetter__ for properties of a HopObject, which are
>> defined in type.properties, can I?
>
> Looks like no. Which is at odds with the treatment of standard
> properties. E.g., in Rhino and Firefox 2,
>
> a = { a:'hi' };
> a.__defineGetter__('a',function(){ return 'bye'; });
> a.a;
>
> the above code returns "bye". But apparently in Firefox 3 you'll  
> have to
> delete a.a first before you can define a getter for it (which makes
> sense to me). I don't know if that works with HopObjects, and I also
> don't know if it would result in that property actually being deleted.
>
> You can't access the stored value of the original property from the
> getter anyway, so trying to overload the actual property seems like a
> bad idea to me. In one case where I've needed a getter/setter (stored
> the value in the DB as an Int unix timestamp, wanted to work with it  
> as
> a Date object) I just named the property .modified_ and wrote my  
> getters
> and setters for .modified.
>
> -Joshua
> _______________________________________________
> Helma-user mailing list
> Helma-user <at> helma.org
> http://helma.org/mailman/listinfo/helma-user

Gmane