You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Luca Morandini <lm...@ieee.org> on 2014/09/24 07:22:36 UTC
Fun with dates on CouchDB 1.5.0 and 1.5.1
Folks,
I have some views that parse timestamps, and they used to work on 1.2.0 and 1.5.0,
but not on 1.5.1
To make my point, I executed this view fragment on both 1.5.0 and 1.5.1:
log("XXXXXXXXXXXXXXXXXXXXXXXX");
timestamp= "2014-06-11T04:46:09.011+0000";
log(" string:" + timestamp + " date:" + (new Date(Date.parse(timestamp))));
timestamp= "2014-06-11T04:46:09.011";
log(" string:" + timestamp + " date:" + (new Date(Date.parse(timestamp))));
timestamp= "2014-06-11T04:46:09.011Z";
log(" string:" + timestamp + " date:" + (new Date(Date.parse(timestamp))));
timestamp= "2014-06-11";
log(" string:" + timestamp + " date:" + (new Date(Date.parse(timestamp))));
log("XXXXXXXXXXXXXXXXXXXXXXXX");
The results are
On 1.5.0:
Log :: XXXXXXXXXXXXXXXXXXXXXXXX
Log :: string:2014-06-11T04:46:09.011+11:00 date:Wed Jun 11 2014 03:46:09
GMT+1000 (EST)
Log :: string:2014-06-11T04:46:09.011 date:Wed Jun 11 2014 04:46:09 GMT+1000 (EST)
Log :: string:2014-06-11T04:46:09.011Z date:Wed Jun 11 2014 14:46:09 GMT+1000 (EST)
Log :: string:2014-06-11 date:Wed Jun 11 2014 10:00:00 GMT+1000 (EST)
Log :: string:2014-06-11T04:46:09.011Z date:Wed Jun 11 2014 14:46:09 GMT+1000 (EST)
Log :: XXXXXXXXXXXXXXXXXXXXXXXX
...everything is fine.
On 1.5.1:
Log :: XXXXXXXXXXXXXXXXXXXXXXXX
Log :: string:2014-06-11T04:46:09.011+11:00 date:Invalid Date
Log :: string:2014-06-11T04:46:09.011 date:Invalid Date
Log :: string:2014-06-11T04:46:09.011Z date:Invalid Date
Log :: string:2014-06-11 date:Invalid Date
Log :: string:2014-06-11T04:46:09.011Z date:Invalid Date
Log :: XXXXXXXXXXXXXXXXXXXXXXXX
Therefore, it looks like I am getting invalid dates no matter what on 1.5.1... can
someone shed some light ?
1.5.1 runs on: CentOS 2.6.32-431.17.1.el6.x86_64, Erlang R14B04 (erts-5.8.5) and
it was compiled from source, since no binary is available for said environment.
Regards,
Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Re: Fun with dates on CouchDB 1.5.0 and 1.5.1
Posted by Luca Morandini <lm...@ieee.org>.
On 25/09/14 08:56, Mike Marino wrote:
> Hi Luca,
...
> executable correctly links against the spidermonkey libraries. If you go
> through all those steps and it's still not working, we can try to debug
> further.
Thanks for your thorough reply, Mike. A sysadmin of ours is working on it... we'll
see.
Regards,
Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Re: Fun with dates on CouchDB 1.5.0 and 1.5.1
Posted by Luca Morandini <lm...@ieee.org>.
On 25/09/14 08:56, Mike Marino wrote:
> Hi Luca,
>
> couchjs is linking against libjs, not spidermonkey (currently supported
> 1.8.5, should be libmozjs185.so).
After a strenuous labour, the sysadmin delivered CouchDB 1.6.1 built against
Erlang 5.8.5 and SpiderMonkey 1.8.5... and it works :)
Thanks once more, Mike.
Regards,
Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Re: Fun with dates on CouchDB 1.5.0 and 1.5.1
Posted by Mike Marino <mm...@gmail.com>.
Hi Luca,
couchjs is linking against libjs, not spidermonkey (currently supported
1.8.5, should be libmozjs185.so). A few questions:
- Did you compile couchjs as well with couchdb, or did you install it
separately e.g. with node.js?
- If you compiled, did you compile/install spidermonkey?
- Did you explicitly call configure on couchdb with eg --with-js-lib?
It might be good to get the couchdb config.log via a friendpaste to see all
the options you configured with and what was found.
To save you some back and forth (I'll be offline in a few minutes), I'll
give you my best guess as to what needs to be done: if perhaps you didn't
install spidermonkey, I would suggest you compile/install the correct
version and make sure that is found by the couchdb configure. If it's not
found or the wrong libjs is found, explicitly point configure to the
correct library. Then, recompile and make sure the produced couchjs
executable correctly links against the spidermonkey libraries. If you go
through all those steps and it's still not working, we can try to debug
further.
Cheers,
Mike
On Thu, Sep 25, 2014 at 12:10 AM, Luca Morandini <lm...@ieee.org>
wrote:
> On 25/09/14 01:14, Mike Marino wrote:
>
> Thanks for your time, Mike; here's what you requested:
>
> couchjs -V
> couchjs - Apache CouchDB 1.5.1
>
> cat test.js
> var o = new Date(Date.parse("2014-06-11T04:46:09.011Z")); print(o);
> couchjs test.js
> Invalid Date
>
> ldd `which couchjs`
> linux-vdso.so.1 => (0x00007fffce5ff000)
> libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x000000381be00000)
> libjs.so.1 => /usr/lib64/libjs.so.1 (0x00000032b9e00000)
> libm.so.6 => /lib64/libm.so.6 (0x0000003814a00000)
> libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003816600000)
> libc.so.6 => /lib64/libc.so.6 (0x0000003813a00000)
> libidn.so.11 => /lib64/libidn.so.11 (0x0000003815a00000)
> libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x0000003819200000)
> librt.so.1 => /lib64/librt.so.1 (0x0000003814200000)
> libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2
> (0x000000381ae00000)
> libkrb5.so.3 => /lib64/libkrb5.so.3 (0x000000381a200000)
> libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x000000381a600000)
> libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003818a00000)
> libz.so.1 => /lib64/libz.so.1 (0x0000003814600000)
> libssl3.so => /usr/lib64/libssl3.so (0x0000003816200000)
> libsmime3.so => /usr/lib64/libsmime3.so (0x0000003818e00000)
> libnss3.so => /usr/lib64/libnss3.so (0x0000003816a00000)
> libnssutil3.so => /usr/lib64/libnssutil3.so (0x0000003817e00000)
> libplds4.so => /lib64/libplds4.so (0x0000003816e00000)
> libplc4.so => /lib64/libplc4.so (0x0000003817200000)
> libnspr4.so => /lib64/libnspr4.so (0x0000003818200000)
> libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003813e00000)
> libdl.so.2 => /lib64/libdl.so.2 (0x0000003813600000)
> libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x000000381c200000)
> libfreebl3.so => /lib64/libfreebl3.so (0x0000003815e00000)
> /lib64/ld-linux-x86-64.so.2 (0x0000003813200000)
> liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x000000381b200000)
> libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003815600000)
> libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x0000003817600000)
> libkrb5support.so.0 => /lib64/libkrb5support.so.0
> (0x0000003819600000)
> libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003819a00000)
> libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000381ba00000)
> libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x000000381b600000)
> libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003814e00000)
>
>
> Regards,
>
> Luca Morandini
> Data Architect - AURIN project
> Melbourne eResearch Group
> Department of Computing and Information Systems
> University of Melbourne
> Tel. +61 03 903 58 380
> Skype: lmorandini
>
>
Re: Fun with dates on CouchDB 1.5.0 and 1.5.1
Posted by Luca Morandini <lm...@ieee.org>.
On 25/09/14 01:14, Mike Marino wrote:
Thanks for your time, Mike; here's what you requested:
couchjs -V
couchjs - Apache CouchDB 1.5.1
cat test.js
var o = new Date(Date.parse("2014-06-11T04:46:09.011Z")); print(o);
couchjs test.js
Invalid Date
ldd `which couchjs`
linux-vdso.so.1 => (0x00007fffce5ff000)
libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x000000381be00000)
libjs.so.1 => /usr/lib64/libjs.so.1 (0x00000032b9e00000)
libm.so.6 => /lib64/libm.so.6 (0x0000003814a00000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003816600000)
libc.so.6 => /lib64/libc.so.6 (0x0000003813a00000)
libidn.so.11 => /lib64/libidn.so.11 (0x0000003815a00000)
libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x0000003819200000)
librt.so.1 => /lib64/librt.so.1 (0x0000003814200000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x000000381ae00000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x000000381a200000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x000000381a600000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003818a00000)
libz.so.1 => /lib64/libz.so.1 (0x0000003814600000)
libssl3.so => /usr/lib64/libssl3.so (0x0000003816200000)
libsmime3.so => /usr/lib64/libsmime3.so (0x0000003818e00000)
libnss3.so => /usr/lib64/libnss3.so (0x0000003816a00000)
libnssutil3.so => /usr/lib64/libnssutil3.so (0x0000003817e00000)
libplds4.so => /lib64/libplds4.so (0x0000003816e00000)
libplc4.so => /lib64/libplc4.so (0x0000003817200000)
libnspr4.so => /lib64/libnspr4.so (0x0000003818200000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003813e00000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003813600000)
libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x000000381c200000)
libfreebl3.so => /lib64/libfreebl3.so (0x0000003815e00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003813200000)
liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x000000381b200000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003815600000)
libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x0000003817600000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x0000003819600000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003819a00000)
libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000381ba00000)
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x000000381b600000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003814e00000)
Regards,
Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
Re: Fun with dates on CouchDB 1.5.0 and 1.5.1
Posted by Mike Marino <mm...@gmail.com>.
Hi Luca,
I have not personally seen this and we certainly use Date parsing in our
views, though it's possible we jumped over 1.5.1 and went straight to
1.6(.1). Perhaps a few things to try to shed some more light here.
What do the couchjs executables look like on each system? That is:
> couchjs -V
> ldd `which couchjs`
And then the output of the program:
> cat test.js
var o = new Date(Date.parse("2014-06-11T04:46:09.011Z"));
print(o);
> couchjs test.js
Probably best to use gist or friendpaste (or similar) when posting the
results back to the list.
Cheers,
Mike
On Wed, Sep 24, 2014 at 7:22 AM, Luca Morandini <lm...@ieee.org> wrote:
> Folks,
>
> I have some views that parse timestamps, and they used to work on 1.2.0
> and 1.5.0, but not on 1.5.1
>
> To make my point, I executed this view fragment on both 1.5.0 and 1.5.1:
> log("XXXXXXXXXXXXXXXXXXXXXXXX");
> timestamp= "2014-06-11T04:46:09.011+0000";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> timestamp= "2014-06-11T04:46:09.011";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> timestamp= "2014-06-11T04:46:09.011Z";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> timestamp= "2014-06-11";
> log(" string:" + timestamp + " date:" + (new
> Date(Date.parse(timestamp))));
> log("XXXXXXXXXXXXXXXXXXXXXXXX");
>
> The results are
> On 1.5.0:
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
> Log :: string:2014-06-11T04:46:09.011+11:00 date:Wed Jun 11 2014
> 03:46:09 GMT+1000 (EST)
> Log :: string:2014-06-11T04:46:09.011 date:Wed Jun 11 2014 04:46:09
> GMT+1000 (EST)
> Log :: string:2014-06-11T04:46:09.011Z date:Wed Jun 11 2014 14:46:09
> GMT+1000 (EST)
> Log :: string:2014-06-11 date:Wed Jun 11 2014 10:00:00 GMT+1000 (EST)
> Log :: string:2014-06-11T04:46:09.011Z date:Wed Jun 11 2014 14:46:09
> GMT+1000 (EST)
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
> ...everything is fine.
>
> On 1.5.1:
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
> Log :: string:2014-06-11T04:46:09.011+11:00 date:Invalid Date
> Log :: string:2014-06-11T04:46:09.011 date:Invalid Date
> Log :: string:2014-06-11T04:46:09.011Z date:Invalid Date
> Log :: string:2014-06-11 date:Invalid Date
> Log :: string:2014-06-11T04:46:09.011Z date:Invalid Date
> Log :: XXXXXXXXXXXXXXXXXXXXXXXX
>
> Therefore, it looks like I am getting invalid dates no matter what on
> 1.5.1... can someone shed some light ?
>
> 1.5.1 runs on: CentOS 2.6.32-431.17.1.el6.x86_64, Erlang R14B04
> (erts-5.8.5) and it was compiled from source, since no binary is available
> for said environment.
>
> Regards,
>
> Luca Morandini
> Data Architect - AURIN project
> Melbourne eResearch Group
> Department of Computing and Information Systems
> University of Melbourne
> Tel. +61 03 903 58 380
> Skype: lmorandini
>
>