Code Monkey home page Code Monkey logo

Comments (3)

mbroadst avatar mbroadst commented on May 30, 2024

@Rush yeah, hmm memory is pretty tricky in these cases. There are a few ways to ensure the objects stick around (I think the persistent handle, as well as an explicit internal counter that can be increased), but then you need to ensure it's dereffed when it's no longer needed - big headaches here.

Would it be possible to write a simple "manual" test case that we could run as part of the automated test suite? We could run that one with expose-gc so you could explicitly call for garbage collection in it, and would serve as a great starting point for finding a solution to the problem

from node-libvirt.

mbroadst avatar mbroadst commented on May 30, 2024

@Rush I'm running the following snippit:

'use strict';
var virt = require('..'),
    fixture = require('./lib/helper').fixture;

// continuously run gc every 100ms
if (global.gc) setInterval(global.gc, 100);

var xml = fixture('storage_volume.xml');
var hv = new virt.Hypervisor('test:///default');
hv.connectAsync()
  .then(function() { return hv.lookupStoragePoolByNameAsync('default-pool'); })
  .then(function(pool) { return pool.createVolumeAsync(xml); })
  .catch(function(err) { console.log('error: ', err); });

and getting this output:

mbroadst@retinoid:node-libvirt (master=)$ node --expose-gc test/issue65.js
Assertion failed: (result == 0), function ClearHandle, file ../src/nlv_object.h, line 60.
Abort trap: 6

does that look like what you're running into?

from node-libvirt.

mbroadst avatar mbroadst commented on May 30, 2024

@Rush update here, that does look like the relevant error however I think we've tapped out my creativity on solving the problem 😄 I've spend about an hour trying to figure out how to "attach" the parent to the child object from the C++ side, but it seems incredibly difficult.

I did, on the other hand, find a solution through javascript which might be the way to go (but then we've got a bit of work ahead of us) through this monkey-patch in index.js:

var $createVolumeAsync = libvirt.StoragePool.prototype.createVolumeAsync;
libvirt.StoragePool.prototype.createVolumeAsync = function(options) {
  var self = this;
  return $createVolumeAsync.call(self, options)
    .then(function(volume) {
      volume._pool = self;
      return volume;
    });
};

from node-libvirt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.