CBL Cordova plugin - Internal server Error 500 - Cannot rebuilt Views

196 views
Skip to first unread message

Andrew

unread,
Dec 22, 2014, 11:40:08 AM12/22/14
to mobile-c...@googlegroups.com


I started seeing this error in CB Lite on iOS using Cordova plugin 1.0.2

We are deleting a document by id and then trying to refetch the entire list of documents fresh.

17:33:10.949‖ WARNING: CouchbaseLite: Failed to rebuild views (research-views/documentsByLastModified, research-views/documentTemplates, research-views/components, research-views/componentTemplates, research-views/documents, research-views/composerOptions): 594

2014-12-22 17:33:10.949 Author[15867:5c03] *** ASSERTION FAILED: Cannot reindex view 'research-views/documents' which has no map block set

2014-12-22 17:33:10.950 Author[15867:5c03] *** Assertion failure in __51-[CBLDatabase(ViewIndexing) updateIndexes:forView:]_block_invoke(), /Users/jenkins/jenkins/workspace/build_cblite_ios_103-enterprise/couchbase-lite-ios/Source/CBLView+Internal.m:265

2014-12-22 17:33:10.950 Author[15867:90b] ["View query failed","documentTemplates",{"status":500,"error":"Internal error"}]

17:33:10.951‖ WARNING: Exception caught in CBLDatabase transaction:

Assertion failed: Cannot reindex view 'research-views/documents' which has no map block set

5   Author                              0x0005a559 __51-[CBLDatabase(ViewIndexing) updateIndexes:forView:]_block_invoke + 9304

6   Author                              0x0004e6f9 -[CBLDatabase(Internal) _inTransaction:] + 175

7   Author                              0x00057f8e -[CBLDatabase(ViewIndexing) updateIndexes:forView:] + 169

8   Author                              0x00057e4b -[CBLView(Internal) updateIndex] + 98

9   Author                              0x001124d6 -[CBL_Router(Handlers) queryDesignDoc:view:keys:] + 293

10  Author                              0x001129bd -[CBL_Router(Handlers) do_GET:designDocID:view:] + 68

11  Author                              0x0010761a -[CBL_Router route] + 1974

12  Author                              0x00107fbc -[CBL_Router run] + 960

13  Author                              0x00109525 __19-[CBL_Router start]_block_invoke + 73

14  Author                              0x0005fa14 __34-[CBL_Server tellDatabaseManager:]_block_invoke + 40

15  libobjc.A.dylib                     0x02d6f82b -[NSObject performSelector:withObject:] + 70

16  Foundation                          0x01ebbe48 __NSThreadPerformPerform + 285

17  CoreFoundation                      0x002c177f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

18  CoreFoundation                      0x002c110b __CFRunLoopDoSources0 + 235

19  CoreFoundation                      0x002de1ae __CFRunLoopRun + 910

...



Any ideas what's going on ?



Andrew

unread,
Dec 22, 2014, 11:50:17 AM12/22/14
to mobile-c...@googlegroups.com
This is intermittent. Once I reset the simulator and started with new db from scratch the delete sequence works fine.

Jens Alfke

unread,
Dec 22, 2014, 12:31:09 PM12/22/14
to mobile-c...@googlegroups.com

On Dec 22, 2014, at 8:40 AM, Andrew <andrzej....@gmail.com> wrote:

2014-12-22 17:33:10.949 Author[15867:5c03] *** ASSERTION FAILED: Cannot reindex view 'research-views/documents' which has no map block set


As the message says, it's trying to update the index of the view "research-views/documents" but there's no map function for the view. Check your design document.

Also: which view were you querying? If it's not the same view, then this could be a bug in 1.0.2 that was fixed in 1.0.3.

—Jens

Andrew

unread,
Dec 22, 2014, 2:37:07 PM12/22/14
to mobile-c...@googlegroups.com
I found out this happens every time we restart the app from Xcode in Simulator without exiting completely from Sim from prior app debug run.

do you mean 1.0.3 which was an GitHub under 1.0.2 or the new 1.0.3-64bit ?

Andrzej Porebski

unread,
Dec 22, 2014, 2:52:42 PM12/22/14
to mobile-c...@googlegroups.com
I checked the design doc. Each one has a map function...

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/cYpjoqb0S88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/2D31802E-0282-4E64-97C9-4A1F4BFBEF7A%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.



--
Thx,
Andrzej

Jens Alfke

unread,
Dec 22, 2014, 3:29:50 PM12/22/14
to mobile-c...@googlegroups.com

On Dec 22, 2014, at 11:37 AM, Andrew <andrzej....@gmail.com> wrote:

do you mean 1.0.3 which was an GitHub under 1.0.2 or the new 1.0.3-64bit ?

Well, I mean Couchbase Lite 1.0.3. I know the version numbering of the PhoneGap plugin has been complicated, so I'm not sure which builds have 1.0.3 in them. You can check by doing a "GET /" and looking at the JSON response.

—Jens

Andrew

unread,
Dec 22, 2014, 4:56:27 PM12/22/14
to mobile-c...@googlegroups.com
So I am running the latest PhoneGap / Cordova plugin.

I am also getting this error on device.

I happens on application startup and usually it happens when the following sequence is observed:

1. Application starts, new db is created and loaded with sample data
2. User adds new item to the database
3. User clicks Home button to put app in bg
4. User double clicks home button and terminates the app from bg execution
5. App is restared but db is not recreated because it already exists


Error happens pretty much every time

Jens Alfke

unread,
Dec 22, 2014, 6:35:17 PM12/22/14
to mobile-c...@googlegroups.com
The bug you're running into is #438, which was fixed in version 1.0.3.1 (which came out a week or two after 1.0.3.)

I wonder whether the updated PhoneGap plugin was accidentally built with 1.0.3 instead of 1.0.3.1… unfortunately Pasin, who did the update last week, isn't in right now.

Until we get this resolved, a workaround for the bug would be to break your views out into separate design docs.

—Jens

Pasin Suriyentrakorn

unread,
Dec 22, 2014, 11:20:58 PM12/22/14
to mobile-c...@googlegroups.com
I checked the build configuration and confirmed that the latest plugin was built with 1.0.3.1. The plugin published on either github repo or cordova registry should have cblite v1.0.3.1 included.

Pasin Suriyentrakorn

unread,
Dec 22, 2014, 11:27:10 PM12/22/14
to mobile-c...@googlegroups.com
One easy way to check the version number of the library included inside the plugin is looking at the Info.plist and the version number is 1.0.3.1


Is it possible that the iOS project doesn't get updated with the new version of the plugin and is still linking with the old version of the framework?

Sometimes removing and re-adding the platform helps resolving the update issue.

Andrzej Porebski

unread,
Dec 23, 2014, 4:08:20 AM12/23/14
to mobile-c...@googlegroups.com
Hi Jens - it looks like the PhoneGap has not been built with the code that included the fix you mention. But there is another option for the fix which I already tried and which seems to be holding up pretty well.

1. Download the latest Couchbase Lite (1.0.3)
2. Go into both frameworks and rename CouchbaseLite to CouchbaseLite.a and CouchbaseLiteListener to CouchbaseLiteListener.a
3. Move both .a into the platform specific directory replacing whatever .a were in there before.

I testes this both on the Simulator and Device - both work well and the issue is no longer.

Really unfortunate it is SO DIFFICULT to make out what is the relationship between CBL release and PhoneGap CBL release,,

Cheers.
Andrew

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/cYpjoqb0S88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thx,
Andrzej

Andrzej Porebski

unread,
Dec 23, 2014, 4:11:52 AM12/23/14
to mobile-c...@googlegroups.com
Looks like something is not right with the Cordova plugin. I replaced its .a with the ones coming from the latest CBL 1.0.3. and now the bug is gone....

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/cYpjoqb0S88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thx,
Andrzej

Jens Alfke

unread,
Dec 23, 2014, 11:23:47 AM12/23/14
to mobile-c...@googlegroups.com

> On Dec 23, 2014, at 1:11 AM, Andrzej Porebski <andrzej....@gmail.com> wrote:
>
> Looks like something is not right with the Cordova plugin. I replaced its .a with the ones coming from the latest CBL 1.0.3. and now the bug is gone….

Hmm. Here's what Pasin posted to the team last night:

> [12/22/14, 8:09:01 PM] Pasin Suriyentrakorn: I rebuilt a new one with 1.0.3.1 so both of these ones contain 1.0.3.1:
> https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin
> http://plugins.cordova.io/#/package/com.couchbase.lite.phonegap
> [12/22/14, 8:09:24 PM] Pasin Suriyentrakorn: Both of them were updated last Friday evening.
> [12/22/14, 8:15:44 PM] Pasin Suriyentrakorn: Here is the built config:
> http://factory.couchbase.com/view/build/view/mobile_dev/view/phone_gap/job/package_phonegap_plugin/lastBuild

That's all I know … maybe it'll help?

—Jens

Andrzej Porebski

unread,
Dec 23, 2014, 12:10:47 PM12/23/14
to mobile-c...@googlegroups.com
OK. I did not look at github since 2 days ago ...perhaps new code has been deployed since then...


—Jens

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/cYpjoqb0S88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thx,
Andrzej
Reply all
Reply to author
Forward
0 new messages