velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Eden <ae...@signaturedomains.com>
Subject Re: velocity is deleting my templates!
Date Mon, 07 Apr 2003 14:30:48 GMT
Well, unfortunately this is now the second case I have heard of where 
files are being deleted while using Velocity.  I posted an email about a 
week-and-a-half ago about potential places in Velocity where streams may 
not be properly closed but alas have heard no response.   I think there 
are some deeper issues going on here because even if the system runs out 
of available file handles there should be no reason for files to be 
deleted - that is just absurd.  I am not even sure that Velocity is the 
problem, but the fact that I seen two reports about it within the last 
two weeks is enough to raise serious concern.

Sincerely,
Anthony Eden

Christoph.Reck@dlr.de wrote:

> Your seem to be suffering of a limited file handle problem and either
> Torque, Texen, or Ant is leaking somewhere. Can you check yourself or 
> take
> the discussion to the Torque (Turbine) list. I have not seen anyoune 
> having
> problems in this area with velocity (that have not been immediately 
> fixed).
>
> You need to ensure that every (input/output) file is closed once 
> completed,
> normally in a finally{...} clause to ensure that when any exception is
> thrown it still does it. Since the ResourceManager of velocity is widely
> used in large sites, i do not suspect the bug in there (but you nerver
> may be comnpleteky sure...), so I advice to start searching in the Torque
> input/output file handling. If you can, please help the comunity with a
> patch.
>
> A dirty workaround is to change the file handles of your OS, probably
> currenlty 2048 (so 30 are consumed by the OS and other applications).
> Since you did not name your OS, nobody can give tips about this...
>
> The fact that is deleting the template is *really* strange. Either this
> is an application bug (most probable), or an OS bug.
>
> Cheers,
> Christoph
>
> David Mitchell wrote:
>
>> Im having a very strange problem with velocity.
>> Im using the torque generator to create java database access layer 
>> classes
>> for each of the 400-odd tables in our application's schema. The 
>> templates to
>> create these files are replacing old crufty perl code that was 
>> previously
>> being used to generate all these files. The existing architecture for 
>> this
>> layer creates 10 java classes (and hence I have 10 templates) per 
>> table. Its
>> not great, I know, but I have to replicate the existing structure before
>> reducing it any.
>>
>> My platform is ant 1.5.1, torque generator 3.1, java 1.4.1, running 
>> on win2k
>> pro. Ive also tried an older version of torque, as well as both 
>> velocity-1.3
>> (which comes with torque generator), and velocity-dev-1.4, built 
>> fresh from
>> the CVS tree.
>>
>> The torque generator is using a derivative of the Texen ant task to 
>> run a
>> control template on each table in an xml schema description.
>>
>> My problem is that after generating exactly 2018 files, velocity 
>> quits out,
>> complaining that it can't find my template, and furthermore, the 
>> template it
>> was looking for gets DELETED! I even tried write-protecting the file, 
>> which
>> keeps it from getting deleted, but velocity still dies after 
>> generating the
>> 2018th file.
>>
>> I didnt find anything in the mailing list archives about this kind of 
>> issue,
>> and I also tried looking at the velocity source code, but I doubt I 
>> will be
>> able to localize the problem in any reasonable amount of time.
>>
>> I was able to easily replicate the problem by creating the following two
>> test templates:
>>
>> (control.vm)
>>
>> #foreach ($i in [1..5000])
>>     $generator.parse("npl/test.vm","$velocityCount","table","")
>> #end
>>
>> (test.vm)
>>
>> testing testing
>>
>> I run the templates as follows:
>>
>>
>>> ant -f build-torque.xml -debug npl-model
>>
>>
>>
>> (after a whole ream of output comes out, it dies with the following
>> traceback, after which, indeed, the template "test.vm" has been 
>> deleted from
>> the disk!)
>>
>> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
>> resource 'npl/test.vm'
>>         at
>> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Resour
>> ceManagerImpl.java:499)
>>         at
>> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Resourc
>> eManagerImpl.java:382)
>>         at
>> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
>> :882)
>>         at
>> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
>> :864)
>>         at
>> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:512)
>>         at
>> org.apache.velocity.texen.Generator.getTemplate(Generator.java:334) at
>> org.apache.velocity.texen.Generator.parse(Generator.java:403)
>>         at 
>> org.apache.velocity.texen.Generator.parse(Generator.java:374)     at 
>> sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>> .java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:324)
>>         at
>> org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(Ub
>> erspectImpl.java:305)
>>         at
>> org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:242
>> )
>>         at
>> org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.ja
>> va:218)
>>         at
>> org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.jav
>> a:263)
>>         at
>> org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
>>         at
>> org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:216)
>>         at
>> org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirect
>>
>> .... and so on....
>>
>>  In the output folder, I have 2018 files, named 1 through 2018.
>>
>>  Anyone out there have any idea what I can do?
>>
>>  yours,
>>  David Mitchell
>>
>>
>> +---------------------------------------------------------+ This 
>> message may contain confidential and/or privileged information.  If you
>> are not the addressee or authorized to receive this for the 
>> addressee, you
>> must not use, copy, disclose or take any action based on this message 
>> or any
>> information herein.  If you have received this message in error, please
>> advise the sender immediately by reply e-mail and delete this message.
>> Thank you for your cooperation.
>> +---------------------------------------------------------+
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message