ondra-novak commented on issue #1010: Compaction of a heavily updated view - 
file descriptor leak (known as ".deleted" issue)
URL: https://github.com/apache/couchdb/issues/1010#issuecomment-346011166
 
 
   UPDATE: Steps to reproduce
   
   1. Create blank database ("testleak" in my example)
   2. Create simple view ("_design/test/_view/test" in my example)
   
   in first terminal
   
   3. Create some dummy documents
   ```$ curl -H "Content-Type:application/json" --data-binary "{}" 
http://localhost:5984/testleak```
   4. Update view and ask for changes using the the same connection
   ```$ curl http://localhost:5984/testleak/_design/test/_view/test 
"http://localhost:5984/testleak/_changes?since=now&heartbeat=true&feed=continuous"```
   
   In other terminal
   
   5. become root
   6. pidof beam.smp (2200 in my case)
   7. cd /proc/2200/fd
   8. ls -la | grep -iE "(delete|mrview)"
   
   you will see just only opened mrviews
   
   ```lrwx------ 1 couchdb couchdb 64 lis 21 12:49 28 -> 
/var/lib/couchdb/.testleak_design/mrview/62e2ed5df6a6694c0438c7724137ca0c.view```
   
   9. compact the view _design/test
   
   10. repeat step 8
   ```
   lrwx------ 1 couchdb couchdb 64 lis 21 12:49 28 -> 
/var/lib/couchdb/.testleak_design/mrview/62e2ed5df6a6694c0438c7724137ca0c.view
   lrwx------ 1 couchdb couchdb 64 lis 21 12:48 55 -> 
/var/lib/couchdb/.delete/bd46813bf2ecea0dad0c41dbbc89cb83 (deleted)
   ```
   
   The deleted file stays there until the connection is closed (press control-c 
in the first terminal). If you want to see multiple deleted files, you will 
need to create script, which uses single connection to repeatedly update the 
view. Each compaction generates new deleted file. These files are persists, 
until  the connection is disconnected. 
   
   Sometimes it could be very difficult to disconnect some connections, for 
example if the connection is used to receive changes.
   
   Version 1.7.1

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to