Closed nikwest closed 7 years ago
Any news about this problem ? I got a similar problem with the update method.
Hmm. I tried to reproduce and while I don't have couch 2.0 installed anywhere, this works fine against Couch 1.5 and 1.6. On what system are you running this ?
I tested my application with CouchDB 1.6.1 now and the problem is away. It seems to be only a problem with couch db 2.0
CouchDB 2.0 on macOS worked fine. I just reproduced this problem on Ubuntu 16.04 with CouchDB 2.0. When connected to CouchDB 2.0 on Linux, we seem to get stuck in the repeat statement at line 343: https://github.com/IBM-Swift/Kitura-net/blob/master/Sources/KituraNet/ClientRequest.swift
For me this problem also exists on MacOS 10.11.6.
Same issue on MacOS 10.12.2 with update() on clean install of CouchDB 2.0.0 as well as Cloudant on Bluemix. CouchDB 1.6.1 seems to work fine. Here is some test code and output in Xcode:
func updateDoc() {
Log.info("Updating document")
let id = "4eb3659b5c75c61caa985118a6000897"
let rev = "3-987be9bdf943f7368b87fafb725f09a2"
let json = JSON([
"_id": id,
"_rev": rev,
"name": "updated test 1",
"value": 1
])
database.update(id, rev: rev, document: json) { rev, doc, err in
if err != nil {
Log.info("Update failed")
return
}
Log.info("Completed Update")
Log.info("New Revision: \(rev!)")
}
}
updateDoc()
Output for CouchDB 1.6.1
[2017-01-21T15:34:48.998-06:00] [INFO] [main.swift:26 updateDoc()] Updating document
[2017-01-21T15:34:49.016-06:00] [INFO] [main.swift:45 updateDoc()] Completed Update
[2017-01-21T15:34:49.016-06:00] [INFO] [main.swift:46 updateDoc()] New Revision: 4-a974df830c2742e1d72a3b76bf21ce62
Program ended with exit code: 0
Output for CouchDB 2.0.0 - Starts and then hangs until it is killed (Same output for Bluemix Cloudant)
[2017-01-21T15:40:23.180-06:00] [INFO] [main.swift:26 updateDoc()] Updating document
Message from debugger: failed to send the k packet
Program ended with exit code: 6
I have recreated this problem on macOS using Kitura-CouchDB's own unit tests.
The problem is in KituraNet. I'm fixing this under issue IBM-Swift/Kitura#980
@nikwest @Spriter @jackd942 The fix has been tagged in Kitura-net 1.5.2 Could you please validate that a fresh pull of Kitura and Kitura-net 1.5 fixes this issue for you.
@na-gupta @shmuelk All seems well. Thanks for the work!
@na-gupta All seems to work fine. Thanks for the fix!
When calling the method usersDatabase().createUser() on couchDBClient it will never return. Is seems to get stuck in an endless loop in the network stack. The user will be created in couchDB, but the call never returns.
Here is my test code:
I run it against a fresh, local couchDB 2.0 instance.
The stack trace is:
I tested with the latest released Kitura stack
It's probably a Kitura-net problem, but I'm just starting using the stack and not familiar with the low level stuff.