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

TypeOrm cause MaxListenersExceededWarning #636

Closed
michaelsogos opened this issue Sep 13, 2020 · 4 comments
Closed

TypeOrm cause MaxListenersExceededWarning #636

michaelsogos opened this issue Sep 13, 2020 · 4 comments

Comments

@michaelsogos
Copy link

michaelsogos commented Sep 13, 2020

With version 0.2.25 of TypeOrm, when I try to save 10 records at once using Repository.Save(), nodejs print the "MaxListenersExceededWarning".

Typeorm project owners already knows about "MaxListenersExceededWarning" with PGSQL server (exactly my case).
Typeorm Issue Here

Actually i don't want to add manually the package typeorm@0.2.26, i prefer to let this library to include the right version of typeorm; so i will wait till a newer package version will be released which will include a newer package version of typeorm.

@kamilmysliwiec
Copy link
Member

Fixed

@climmmm
Copy link

climmmm commented Sep 22, 2020

Hello,

Sorry, but we always have the warning displayed when we want to register an entity in the PostgresSQL database:

(node:11170) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Client]. Use emitter.setMaxListeners() to increase the limit.

Code sample:

import { Injectable } from '@nestjs/common';
import { Repository } from 'typeorm';
import { GbfsRt } from './gbfs-rt.entity';
import { InjectRepository } from '@nestjs/typeorm';
@Injectable()
export class DbGbfsRtService {
  constructor(
    @InjectRepository(GbfsRt)
    private readonly dbGbfsRtRepository: Repository<GbfsRt>,
  ) {
  }

  async saveAll(gbfsRts: GbfsRt[]): Promise<void> {
    try {
      await this.dbGbfsRtRepository.save(gbfsRts);
    } catch (error) {
      throw error;
    }
  }
}

The warning has appeared since we upgraded the @nestjs/typeorm and typeorm packages :
Capture d’écran 2020-09-22 à 11 31 41

@sclausen
Copy link

@climmmm It's fixed in the PR typeorm/typeorm#6708 and discussed in the issue typeorm/typeorm#6699, but not released yet.

@climmmm
Copy link

climmmm commented Sep 22, 2020

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants