#1 2014-05-02 20:54:37

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

AV SpiderMonkey Mustache rendered failed

Windows XP PT SP3 + Delphi XE3 compiler Update 2
mORMot                     2014-05-02 11:17
libnspr4.dll    361 KB    2014-03-29 13:04:00
mozjs-24.dll    2.8 MB    2014-04-25 09:22:34
--------------------------------------------
I would like to play with mustache tmpl but doesn't work for me. sad

==> 22 - JavaScript HTTPApi web server
http://localhost:888/root/mustache.md
http://localhost:888/root/readme.md

Server Error 500: Internal Server Error

EExternalException Exception raised:
External exception 80000003

Synopse mORMot 1.18 http://synopse.info
---------------------------------------------------
Server is now running on http://localhost:888/root

Press [Enter] to quitAssertion failure: lock != NULL, at c:/nspr/pr/src/threads/combined/prulock.c:198
Assertion failure: lock != NULL, at c:/nspr/pr/src/threads/combined/prulock.c:198
------------------------------------------------------
==> 23 - JavaScript Tests

SynSM Automated tests
-----------------------
1. SynSMAPI

1.1. Syn SMAPI:

! Exception EAccessViolation raised with messsage:
!  Access violation at address 005E0509 in module 'mozjs-24.dll'. Read of address 000D4034

Generated with: Delphi XE3 compiler

Time elapsed for all tests: 36.94ms
Tests performed at 2/5/2014 17:34:42

Total assertions failed for all test suits:  0 / 0
! Some tests FAILED: please correct the code.
Done - Press ENTER to Exit
------------------------------------------------------
==> TestSQL3.exe
------------
1.2. Low level types:
  - RTTI: 58 assertions passed  8.02ms
  - Url encoding: 200 assertions passed  1.79ms
  - Encode decode JSON: 261,910 assertions passed  3.17s
!  - Mustache renderer: 5 / 44 FAILED  180.75ms
  - TDocVariant: 70,457 assertions passed  547.56ms
  - BSON: 245,034 assertions passed  24.45ms
  Total failed: 5 / 577,703  - Low level types FAILED  3.93s
---------------------------------------------------------

Offline

#2 2014-05-03 09:32:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

I just tried all those projects with Delphi XE4, and the dll from synsm.7z (the one you are using, according to the time stamps).
With the latest nightly source code from the trunk.
Without any problem.

Are you sure your source code is in synch or that the dll are in the same folder than the executable (and there is no old version in the system path)?

Offline

#3 2014-05-04 05:45:02

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: AV SpiderMonkey Mustache rendered failed

it's working here when I tried it about a week ago.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2014-05-04 12:07:08

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: AV SpiderMonkey Mustache rendered failed

About project 22 - JavaScript HTTPApi web server
It's working fine with Delphi 7. smile The same project with Delphi XE3 Update 2 raises an exception (Server Error 500: Internal Server Error). At least I can test some mustache templates!

About project 23 - JavaScript Tests
Neither D3 nor D7 worked for me with the latest nightly code. sad

I think there's an issue in procedure TTestSynSMAPI.CompilationRoutines; (unit SynSMSelfTest.pas)
I suspect there's something weird with line 256, I put some comments at line 256 and others and I get I better result. neutral
I don't know maybe... I realized that I do not have these "testCompileUnicode.js", "testCompileUTF8.js", "jslint.js"

  // check error, which was in SM17
line 256  Check( JS_EvaluateScript(cx, global, PCChar(ansiScriptStrConcatUndefPlusNum), length(ansiScriptStrConcatUndefPlusNum), 'test', 1, rval) = JS_TRUE, 'ansiScriptStrConcatUndefPlusNum');

  uString := AnyTextFileToSynUnicode(scriptDir + '\testCompileUnicode.js');
  Check(JS_CompileUCScript(cx, global, Pjschar(uString), length(uString), 'test', 1) <> nil, 'compile unicode file');

  uString := AnyTextFileToSynUnicode(scriptDir + '\testCompileUTF8.js');
  Check(JS_CompileUCScript(cx, global, Pjschar(uString), length(uString), 'test', 1) <> nil, 'compile utf8 file');

About project TestSQL3.dpr sad
Unfortunately D7 and D3 always show this error on item
1.2. Low level types:
--> !  - Mustache renderer: 5 / 44 FAILED  180.75ms
I suspect that line 3358 SynSelfTests.pas
for spec := 0 to High(MUSTACHE_SPECS) do begin
    mustacheJsonFileName := MUSTACHE_SPECS[spec]+'.json'; (i think I don't have this file) hmm

Offline

#5 2014-05-05 07:01:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

I tested those samples with Delphi 7, Delphi 2007 and Delphi XE4, without any problem.

Without the stack trace of the errors, it is difficult to tell what's wrong.
Could you please enable detailed map file for debug information, and check the logs?

About project 23, some .js files are indeed missing -also for me (mpv did never send all the .js).
I remember I downloaded mustache.js from github.
Those tests are not 100% validated - this is a work in progress, to be seen as a sample.

About TestSQL3.dpr, the .json files are downloaded from the Internet, directly from GitHub.
Those files are the official regression tests of mustache.
You need to be connected to Internet in order to let all TestSQL3.dpr tests pass.
Once downloaded, they won't download it later (the program checks if the file is already there locally).

Offline

#6 2014-06-10 08:46:14

win2014
Member
Registered: 2014-06-10
Posts: 31

Re: AV SpiderMonkey Mustache rendered failed

I also get the error External Exception 80000003 when I open the executable file name "TestMustache.exe",my ide is xe3 up2,system is win7,but in xp sp3,it also display.

Offline

#7 2014-06-10 08:56:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

I suppose you are not using the latest .dll files.

source code wrote:

{
  -------------------------------------------------------------------------
   Download the SpiderMonkey library at http://synopse.info/files/synsm.7z
   and put mozjs-24.dll and libnspr4.dll files with your TestMustache.exe
  -------------------------------------------------------------------------
}

Offline

#8 2014-06-10 08:59:46

win2014
Member
Registered: 2014-06-10
Posts: 31

Re: AV SpiderMonkey Mustache rendered failed

program SynSMPractise;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  SynSM;

var
  engMan: TSMEngineManager;
  jsEng: TSMEngine;

begin
  try
    engMan := TSMEngineManager.Create();
    jsEng := engMan.ThreadSafeEngine;
    jsEng.Evaluate('var a = 0;');
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  Readln;
  engMan.Free();
end.

These are my practice codes,when I run it without ide,is display
"Assertion failure: lock != NULL, at c:/nspr/pr/src/threads/combined/prulock.c:198
EExternalException: External exception 80000003",if I run it in ide debug mode,it crashed in this line: "fCx.Options := [jsoVarObjFix,jsoBaseLine,jsoTypeInference,jsoIon,jsoAsmJs];".

Offline

#9 2014-06-10 09:10:44

win2014
Member
Registered: 2014-06-10
Posts: 31

Re: AV SpiderMonkey Mustache rendered failed

ab wrote:

I suppose you are not using the latest .dll files.

source code wrote:

{
  -------------------------------------------------------------------------
   Download the SpiderMonkey library at http://synopse.info/files/synsm.7z
   and put mozjs-24.dll and libnspr4.dll files with your TestMustache.exe
  -------------------------------------------------------------------------
}

Yes, I just download dll from this url, and the source are from github, https://github.com/synopse/mORMot(download zip button).

Offline

#10 2014-06-10 09:23:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

I just tested your SynSMPractise program with XE4, and... it works without any problem!
sad

No problem at all with Delphi 7 or XE6...

Offline

#11 2014-06-10 09:37:10

win2014
Member
Registered: 2014-06-10
Posts: 31

Re: AV SpiderMonkey Mustache rendered failed

All right, I will try more.

Offline

#12 2014-06-10 12:05:27

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Re: AV SpiderMonkey Mustache rendered failed

I also have a problem when starting TestMustache in Delphi XE3 .

constructor TSMEngine.Create(aManager: TSMEngineManager);
...
fCx.Options := [jsoVarObjFix,jsoBaseLine,jsoTypeInference,jsoIon,jsoAsmJs];

Error in line JS_SetOptions(@self,uint32(Value))

procedure JSContext.SetOptions(const Value: TJSOptions);
begin
  JS_SetOptions(@self,uint32(Value))
end;

Value: (from debuger)

[jsoUnused5,jsoUnused11,jsoNoScriptRVal,jsoUnrootedGlobal,jsoBaseLine,jsoPcCount,(out of bound) 22,(out of bound) 25]

Offline

#13 2014-06-10 12:23:10

win2014
Member
Registered: 2014-06-10
Posts: 31

Re: AV SpiderMonkey Mustache rendered failed

DigDiver wrote:

I also have a problem when starting TestMustache in Delphi XE3 .

constructor TSMEngine.Create(aManager: TSMEngineManager);
...
fCx.Options := [jsoVarObjFix,jsoBaseLine,jsoTypeInference,jsoIon,jsoAsmJs];

Error in line JS_SetOptions(@self,uint32(Value))

procedure JSContext.SetOptions(const Value: TJSOptions);
begin
  JS_SetOptions(@self,uint32(Value))
end;

Value: (from debuger)

[jsoUnused5,jsoUnused11,jsoNoScriptRVal,jsoUnrootedGlobal,jsoBaseLine,jsoPcCount,(out of bound) 22,(out of bound) 25]

Yes, like to me.

Offline

#14 2014-06-10 13:07:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

XE3 specific issue?
sad

Offline

#15 2014-06-14 01:57:39

win2014
Member
Registered: 2014-06-10
Posts: 31

Re: AV SpiderMonkey Mustache rendered failed

There are no problems in XE6, sample TestMustacheUnit runs very well!

Offline

#16 2014-07-03 10:47:49

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: AV SpiderMonkey Mustache rendered failed

We do not test under XE3 (we do not have it). Under D7 & XE2 everything is OK.... May be this is really XE3 problem sad

Last edited by mpv (2014-07-03 10:48:14)

Offline

#17 2014-07-03 14:48:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

I do not have XE3 installed.
We tested with Delphi 7, 2007, XE4 and XE6 without any problem...
sad

Offline

#18 2014-09-16 12:49:23

jonjbar
Member
Registered: 2012-12-27
Posts: 37

Re: AV SpiderMonkey Mustache rendered failed

I can confirm the exception for JS_SetOptions on Delphi XE 3 sad

Offline

#19 2014-09-16 15:25:44

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: AV SpiderMonkey Mustache rendered failed

We do not have XE3 on hand, so can't debug this issue. Somebody REALLY need SM for XE3?

Offline

#20 2014-09-18 10:20:19

jonjbar
Member
Registered: 2012-12-27
Posts: 37

Re: AV SpiderMonkey Mustache rendered failed

mpv wrote:

Somebody REALLY need SM for XE3?

No but it's not reassuring that a specific Delphi version crashes wink
Anything we can do to try to debug this issue ?
Also, perhaps this should be prominently written somewhere to avoid people thinking either they got the wrong DLLs or the code is not working at all.

Offline

#21 2014-09-18 10:59:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

Sounds really like a XE3 bug.
Did you try with diverse compilation options (like debug/release mode, with or without optimization, etc...).

Could you try

  JS_SetOptions(@self,uint32(Value) and pred(1 shl (ord(high(TJSOption))+1)));

But if what you show is real, then XE3 seems to pass a totally wrong/random value to the method...
So this won't be enough.

Offline

#22 2014-09-18 13:17:40

jonjbar
Member
Registered: 2012-12-27
Posts: 37

Re: AV SpiderMonkey Mustache rendered failed

I've tried multiple compilation options without any success. I've also tried disabling IDEFixPack without success.
The new code doesn't change anything either. And indeed, it looks like a wrong value is passer to the method.

So this is what I tried and it fixed the problem is:
- Make JSContext.SetOptions public
- In TSMEngine.Create call it instead of assigning to the property

Not sure how this can be explained.

Offline

#23 2014-09-19 17:08:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

I've made the following modification for XE3:
http://synopse.info/fossil/info/af94b213a1

BTW, did you try to define the method as such:

procedure JSContext.SetOptions(Value: TJSOptions);

(i.e. without the "const")

Offline

#24 2014-09-22 10:21:59

jonjbar
Member
Registered: 2012-12-27
Posts: 37

Re: AV SpiderMonkey Mustache rendered failed

ab wrote:

BTW, did you try to define the method as such:

procedure JSContext.SetOptions(Value: TJSOptions);

(i.e. without the "const")

Unfortunately this still produces an exception in XE3.

Offline

#25 2014-09-23 09:24:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: AV SpiderMonkey Mustache rendered failed

So I can't find out any workaround for XE3....

Is there not any update for XE3?

Offline

Board footer

Powered by FluxBB