Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled Support for Node.js 5.x & 6.x #1031

Closed
brianhyder opened this issue May 8, 2016 · 3 comments
Closed

Enabled Support for Node.js 5.x & 6.x #1031

brianhyder opened this issue May 8, 2016 · 3 comments

Comments

@brianhyder
Copy link
Member

brianhyder commented May 8, 2016

Description:
We've had a lot of questions regarding failures when using node 5.x. We should investigate these and provide fixes in order to support these users who click the "download latest" button on the Node.js site.

Steps to Reproduce:
See other issues regarding failures around v5 and v6.

Configuration Details:
N/A

Log Output:
N/A

PencilBlue Version: 0.6.0

Node.js Version: 5.11

Environment Description:
N/A

@JLKM
Copy link

JLKM commented May 10, 2016

My error search so far has led to the method hasOwnProperty, which seems to have become deprecated in the newest version of V8. Don't really know the full implications of that, but others might. Perhaps This description can shed some light on the issue.

Still I'm a little impatient, so I've made the following two quick fixes. They allow me to log in and work without bumping into any errors so far in Node.js 6.1.0:

  1. include\model\create_document.js - line approx. 86:

Changed from:
if (post.hasOwnProperty('password')) {
To:
if ('password' in post) {

  1. include\security\authentication\index.js - line approx. 66:

Changed from:
if (credentials.hasOwnProperty('site')) {
To:
if ('site' in credentials) {

The method hasOwnProperty is used several places in the PencilBlue code. Furthermore, my quick fix also tests for occurences in the prototype chain, which hasOwnProperty doesn't. So I guess, it's only a question of time, when the first error will occur.

That's why a full adaptation to Node.js 6.X would come in really handy...

@brianhyder
Copy link
Member Author

@JLKM in the PR I just merged, last night into 0.6.0 branch, I made those changes to the almost all of the references to hasOwnProperty. I also added a line that would add the prototype function back onto the object to protect against any remaining references.

I understand why they made the change but seems like it will cause more problems than its worth. You can pull the 0.6.0 branch if you'd like to test drive things. The branch should be stable.

@brianhyder brianhyder changed the title Enabled Support for Node.js 5.x Enabled Support for Node.js 5.x & 6.x May 10, 2016
@JLKM
Copy link

JLKM commented May 11, 2016

Thanks a lot for the faster than fast response. About 10 hours. Real impressive. I'll try to catch up!

Have roled the 0.6.0 branch out on my installation. Initialization of existing themes resulted in errors. But that might be a minor thing.

The good news: Login works like a charm. I run multisite, and I can switch from site to site in admin. Also from web in read-mode. Sections and topics are also visible an unchanged.

The bad news: Page-view and article-view fails from admin. I get a big rotatating circle instead.

The weird news: When articles are inaccessible from admin, they still show up in read-mode...

My shot: Deletion of all pages and articles in the corresponding collections in MongoDB. But same result: A rotation circle in the admin view.

But it appears really close to working perfect.

Next I'll try to build up a new 0.6.0 site from scratch - and perhaps multisite: false.

Here are the mongod-logs:

Before deletion of all articles and pages:

C:\Program Files\MongoDB\Server\3.2\bin>mongod
2016-05-11T16:27:53.349+0200 I CONTROL [initandlisten] MongoDB starting : pid=1968 port=27017 dbpath=C:\data\db\ 64-bit host=JLKM1
2016-05-11T16:27:53.356+0200 I CONTROL [initandlisten] targetMinOS: Windows Vista/Windows Server 2008
2016-05-11T16:27:53.357+0200 I CONTROL [initandlisten] db version v3.2.3
2016-05-11T16:27:53.359+0200 I CONTROL [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
2016-05-11T16:27:53.362+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-05-11T16:27:53.364+0200 I CONTROL [initandlisten] modules: none
2016-05-11T16:27:53.371+0200 I CONTROL [initandlisten] build environment:
2016-05-11T16:27:53.374+0200 I CONTROL [initandlisten] distarch: x86_64
2016-05-11T16:27:53.376+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-05-11T16:27:53.378+0200 I CONTROL [initandlisten] options: {}
2016-05-11T16:27:53.409+0200 I - [initandlisten] Detected data files in C:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-05-11T16:27:53.427+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=8G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-05-11T16:27:56.961+0200 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-05-11T16:27:56.961+0200 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2016-05-11T16:27:57.275+0200 I NETWORK [initandlisten] waiting for connections on port 27017
2016-05-11T16:28:57.266+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:55226 #1 (1 connection now open)
2016-05-11T16:28:57.318+0200 I NETWORK [conn1] end connection 127.0.0.1:55226 (0 connections now open)
2016-05-11T16:28:57.343+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:55227 #2 (1 connection now open)
2016-05-11T16:28:57.346+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:55228 #3 (2 connections now open)
2016-05-11T16:28:57.351+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:55229 #4 (3 connections now open)
2016-05-11T16:28:57.355+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:55230 #5 (4 connections now open)
2016-05-11T16:28:57.362+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:55231 #6 (5 connections now open)
2016-05-11T16:28:57.498+0200 I COMMAND [conn6] CMD: dropIndexes pencilblue.server_registry
2016-05-11T16:28:59.226+0200 I INDEX [conn4] build index on: pencilblue.server_registry properties: { v: 1, key: { last_modified: 1 }, name: "last_modified_1", ns: "pencilblue.server_registry", expireAfterSeconds: 10 }
2016-05-11T16:28:59.238+0200 I INDEX [conn4] building index using bulk method
2016-05-11T16:28:59.326+0200 I INDEX [conn4] build index done. scanned 0 total records. 0 secs
2016-05-11T16:28:59.337+0200 I COMMAND [conn4] command pencilblue.$cmd command: createIndexes { createIndexes: "server_registry", indexes: [ { name: "last_modified_1", key: { last_modified: 1 }, expireAfterSeconds: 10 } ] } keyUpdates:0 writeConflicts:0 numYields:0 reslen:113 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { W: 1 } }, Collection: { acquireCount: { w: 1 } } } protocol:op_query 465ms
2016-05-11T16:30:23.343+0200 I COMMAND [conn6] command pencilblue.user command: count { count: "user", query: { object_type: "user", $or: [ { username: "jala" }, { email: "jala" } ], password: "3fbaee1c000eeb88375b6aa81f16fe8d3448690b117c8b3f75aa80cb756d33e872d639f937d10e5e8e111a37a38b7c33882e90c064881b9984d1a10fc679678a", admin: { $gte: 1 }, site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" }, limit: 1 } planSummary: IXSCAN { admin: -1 } keyUpdates:0 writeConflicts:0 numYields:3 reslen:62 locks:{ Global: { acquireCount: { r: 8 } }, Database: { acquireCount: { r: 4 } }, Collection: { acquireCount: { r: 4 } } } protocol:op_query 221ms
2016-05-11T16:30:44.970+0200 I QUERY [conn3] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.article query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" } }
2016-05-11T16:30:44.973+0200 I QUERY [conn3] ntoskip:0 ntoreturn:25
2016-05-11T16:32:53.014+0200 I QUERY [conn3] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.page query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" } }
2016-05-11T16:32:53.016+0200 I QUERY [conn3] ntoskip:0 ntoreturn:25
2016-05-11T16:32:57.146+0200 I QUERY [conn2] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.article query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" } }
2016-05-11T16:32:57.147+0200 I QUERY [conn2] ntoskip:0 ntoreturn:25
2016-05-11T16:33:02.371+0200 I QUERY [conn2] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.page query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" } }
2016-05-11T16:33:02.374+0200 I QUERY [conn2] ntoskip:0 ntoreturn:25
2016-05-11T16:34:13.415+0200 I QUERY [conn2] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.page query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" } }
2016-05-11T16:34:13.417+0200 I QUERY [conn2] ntoskip:0 ntoreturn:25
2016-05-11T16:34:40.543+0200 I QUERY [conn6] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.page query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "90366cc6-1f76-46da-be01-8a8b50bf5ded" } }
2016-05-11T16:34:40.545+0200 I QUERY [conn6] ntoskip:0 ntoreturn:25
2016-05-11T16:34:43.874+0200 I QUERY [conn5] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.article query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "90366cc6-1f76-46da-be01-8a8b50bf5ded" } }
2016-05-11T16:34:43.877+0200 I QUERY [conn5] ntoskip:0 ntoreturn:25
2016-05-11T16:36:44.179+0200 I QUERY [conn4] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.article query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "90366cc6-1f76-46da-be01-8a8b50bf5ded" } }
2016-05-11T16:36:44.181+0200 I QUERY [conn4] ntoskip:0 ntoreturn:25


After deletion of all articles and pages:

C:\Program Files\MongoDB\Server\3.2\bin>mongod
2016-05-11T17:44:48.080+0200 I CONTROL [initandlisten] MongoDB starting : pid=10892 port=27017 dbpath=C:\data\db\ 64-bit host=JLKM1
2016-05-11T17:44:48.085+0200 I CONTROL [initandlisten] targetMinOS: Windows Vista/Windows Server 2008
2016-05-11T17:44:48.087+0200 I CONTROL [initandlisten] db version v3.2.3
2016-05-11T17:44:48.089+0200 I CONTROL [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
2016-05-11T17:44:48.093+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-05-11T17:44:48.095+0200 I CONTROL [initandlisten] modules: none
2016-05-11T17:44:48.099+0200 I CONTROL [initandlisten] build environment:
2016-05-11T17:44:48.101+0200 I CONTROL [initandlisten] distarch: x86_64
2016-05-11T17:44:48.106+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-05-11T17:44:48.109+0200 I CONTROL [initandlisten] options: {}
2016-05-11T17:44:48.113+0200 I - [initandlisten] Detected data files in C:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-05-11T17:44:48.118+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=8G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-05-11T17:44:50.618+0200 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-05-11T17:44:50.618+0200 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2016-05-11T17:44:50.627+0200 I NETWORK [initandlisten] waiting for connections on port 27017
2016-05-11T17:45:34.682+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:56888 #1 (1 connection now open)
2016-05-11T17:45:34.726+0200 I NETWORK [conn1] end connection 127.0.0.1:56888 (0 connections now open)
2016-05-11T17:45:34.745+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:56889 #2 (1 connection now open)
2016-05-11T17:45:34.747+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:56890 #3 (2 connections now open)
2016-05-11T17:45:34.751+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:56891 #4 (3 connections now open)
2016-05-11T17:45:34.758+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:56892 #5 (4 connections now open)
2016-05-11T17:45:34.762+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:56893 #6 (5 connections now open)
2016-05-11T17:45:34.868+0200 I COMMAND [conn6] CMD: dropIndexes pencilblue.server_registry
2016-05-11T17:45:35.333+0200 I INDEX [conn4] build index on: pencilblue.server_registry properties: { v: 1, key: { last_modified: 1 }, name: "last_modified_1", ns: "pencilblue.server_registry", expireAfterSeconds: 10 }
2016-05-11T17:45:35.334+0200 I INDEX [conn4] building index using bulk method
2016-05-11T17:45:35.423+0200 I INDEX [conn4] build index done. scanned 1 total records. 0 secs
2016-05-11T17:45:35.425+0200 I COMMAND [conn4] command pencilblue.$cmd command: createIndexes { createIndexes: "server_registry", indexes: [ { name: "last_modified_1", key: { last_modified: 1 }, expireAfterSeconds: 10 } ] } keyUpdates:0 writeConflicts:0 numYields:0 reslen:113 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { W: 1 } }, Collection: { acquireCount: { w: 1 } } } protocol:op_query 182ms
2016-05-11T17:46:34.117+0200 I QUERY [conn6] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.article query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" } }
2016-05-11T17:46:34.118+0200 I QUERY [conn6] ntoskip:0 ntoreturn:25
2016-05-11T17:46:54.769+0200 I QUERY [conn2] assertion 17287 Can't canonicalize query: BadValue: bad order array [2] ns:pencilblue.page query:{ orderby: [ [ "publish_date", -1 ] ], $query: { site: "2fab71e6-6fbe-4d04-97ec-dc28db30cdb7" } }
2016-05-11T17:46:54.770+0200 I QUERY [conn2] ntoskip:0 ntoreturn:25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants