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

Issue when using idGeneration: 'MONGO' #12

Closed
dpatte opened this issue Jan 14, 2016 · 20 comments
Closed

Issue when using idGeneration: 'MONGO' #12

dpatte opened this issue Jan 14, 2016 · 20 comments
Labels

Comments

@dpatte
Copy link

dpatte commented Jan 14, 2016

While using this module I sometimes get the following error

Exception in defer callback: Error: Future resolved more than once
I20160114-15:20:42.939(-5)?     at Object.Future.return (/home/dpatte/.meteor/packages/meteor-tool/.1.1.10.6elsyt++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:226:10)
I20160114-15:20:42.939(-5)?     at TrackerInstance._runFlush (packages/peerlibrary_server-autorun/packages/peerlibrary_server-autorun.js:186:1)
I20160114-15:20:42.939(-5)?     at packages/peerlibrary_server-autorun/packages/peerlibrary_server-autorun.js:104:1
I20160114-15:20:42.939(-5)?     at packages/peerlibrary_server-autorun/packages/peerlibrary_server-autorun.js:90:1
I20160114-15:20:42.939(-5)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20160114-15:20:42.939(-5)?     at packages/meteor/timers.js:6:1
I20160114-15:20:42.939(-5)?     at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)

I am using calls to Meteor.user().find and .findOne in my publish function. Could this be an issue?

@mitar
Copy link
Member

mitar commented Jan 15, 2016

Please create a reproduction. I do not get such errors and I cannot really help much without something to work here.

One thing to have in mind here is that such errors can occur when there are some other error conditions happening. So because things are asynchronous one side can fail, resolve the future as failure, while something else keeps running and tries to resolve it later again.

I am using calls to Meteor.user().find and .findOne in my publish function. Could this be an issue?

It shouldn't be, but maybe it is. Please make a reproduction.

@mitar
Copy link
Member

mitar commented Jan 20, 2016

Ping?

@dpatte
Copy link
Author

dpatte commented Jan 25, 2016

Sorry for the delay, but I have switched to Reywood:Publish-Composite now, which seems to handle my use case better for me.

@dpatte dpatte closed this as completed Jan 25, 2016
@mzygmunt
Copy link

I've the same issue.

Exception in defer callback: Error: Future resolved more than once
I20160313-23:24:54.901(1)? at Object.Future.return (/Users/mzygmunt/.meteor/packages/meteor-tool/.1.1.11-faster-rebuild.0.d7n8jc++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:226:10)
I20160313-23:24:54.901(1)? at TrackerInstance._runFlush (packages/peerlibrary_server-autorun/packages/peerlibrary_server-autorun.js:186:1)
I20160313-23:24:54.901(1)? at packages/peerlibrary_server-autorun/packages/peerlibrary_server-autorun.js:104:1
I20160313-23:24:54.901(1)? at packages/peerlibrary_server-autorun/packages/peerlibrary_server-autorun.js:90:1
I20160313-23:24:54.902(1)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20160313-23:24:54.902(1)? at packages/meteor/timers.js:6:1
I20160313-23:24:54.902(1)? at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)

Here is my source of publish func:

Meteor.publish('test', function () {
    this.autorun(function (computation) {
        let token = self._token.get(); //get token string
        let objID = new Meteor.Collection.ObjectID((token));
        return Sessions.find({_id: objID});
    })
});

@mitar
Copy link
Member

mitar commented Mar 13, 2016

Can you create a reproduction?

@mzygmunt
Copy link

test.js

Books = new Mongo.Collection('books', {idGeneration: 'MONGO'});

if (Meteor.isClient) {
    Meteor.subscribe('books');

    Template.test.helpers({
        books: function () {
            return Books.find();
        }
    });

    Template.test.events({
        'click #showComedies': function () {
            Meteor.call('showComedies');
        },
        'click #showHorrors': function () {
            Meteor.call('showHorrors');
        }
    });
}

if (Meteor.isServer) {
    let cat = new ReactiveVar('comedy');

    Meteor.methods({
        showComedies: function () {
            cat.set('comedy');
        },
        showHorrors: function () {
            cat.set('horror');
        }
    });

    Meteor.publish('books', function () {
        this.autorun(function (computation) {
            return Books.find({cat: cat.get()});
        });
    });

    Meteor.startup(function () {
        Books.remove({});
        Books.insert({title: 'Book 1', cat: 'comedy'});
        Books.insert({title: 'Book 2', cat: 'comedy'});
        Books.insert({title: 'Book 3', cat: 'horror'});
        Books.insert({title: 'Book 4', cat: 'comedy'});
        Books.insert({title: 'Book 5', cat: 'horror'});
    });
}
<head>
    <title>test</title>
</head>

<body>
{{> test}}
</body>

<template name="test">
    <button id="showComedies">Show comedies</button>
    <button id="showHorrors">Show horrors</button>
    <ul>{{#each books}}
        <li>{{title}}</li>
    {{/each}}</ul>
</template>

And please click "Show horrors".

It seems {idGeneration: 'MONGO'} and default MongoID causes problem. With default Meteor's ids all works fine.

@mitar
Copy link
Member

mitar commented Mar 13, 2016

Sorry, by reproduction I meant a repository I can clone and run. See documentation here. In this way it will really simplify the amount of work I have to do, but I do understand that it requires a bit more work on your side.

@mitar mitar reopened this Mar 13, 2016
@mzygmunt
Copy link

@mitar
Copy link
Member

mitar commented Mar 14, 2016

Hm, how often does it happens? I cannot reproduce it.

@mitar
Copy link
Member

mitar commented Mar 14, 2016

Can anyone else reproduce it?

@dpatte
Copy link
Author

dpatte commented Mar 14, 2016

This is what I saw as well.

@mitar
Copy link
Member

mitar commented Mar 14, 2016

@dpatte: Can you elaborate a bit? Do you see with this repository an error or not when you click the button? Every time?

Which operating system are you using? Are you just running meteor or some other version of Meteor?

@dpatte
Copy link
Author

dpatte commented Mar 14, 2016

I opened this ticket, actually, and haven't tried the new repo provided, but while I was using your module I was seeing the same errors from your module as @mzygmunt is now reporting. They occurred whenever a publish occurred. I was running Meteor on Ubuntu 12.04, in a dev environment.

@mitar
Copy link
Member

mitar commented Mar 14, 2016

Yes, my question is about the reproduction. We want to get a clean reproduction and understand why this is happening to you, while it is not happening to others (or me).

@dpatte
Copy link
Author

dpatte commented Mar 14, 2016

If I have a chance, I'll try the repo, but until then, I may be able to help based on what I remember, if you have any other questions.

@mzygmunt
Copy link

@mitar I updated the repo. Please check it again.

https://github.com/mzygmunt/reactive-publish-bug.git

@mitar
Copy link
Member

mitar commented Mar 14, 2016

Perfect. I can reproduce this.

@mitar mitar added bug and removed needs feedback labels Mar 14, 2016
@mitar mitar changed the title Issue with Future Issue with Future when using idGeneration: 'MONGO' Mar 14, 2016
@mzygmunt
Copy link

That's great! When can we expect to solve the problem?

@mitar
Copy link
Member

mitar commented Mar 14, 2016

Not so sure. I am a bit busy these weeks. But it seems that the problem is that there is no good support for this IDs in reactive-publish package. The future issue is just a side effect when error is being thrown. It hides the real error.

@MKRazz
Copy link

MKRazz commented Jun 28, 2016

+1

@mitar mitar changed the title Issue with Future when using idGeneration: 'MONGO' Issue when using idGeneration: 'MONGO' Aug 1, 2016
@mitar mitar closed this as completed in 7000871 Aug 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants