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

GC problem #245

Closed
HOTTIN opened this issue Dec 4, 2018 · 1 comment
Closed

GC problem #245

HOTTIN opened this issue Dec 4, 2018 · 1 comment

Comments

@HOTTIN
Copy link

HOTTIN commented Dec 4, 2018

Node.js Version: V8.5.0

Operating System: centos 7

Steps to Produce Error:
when i user opossum like this, i got a GC problem:

class rqService extends app.Service {
    async request(url, opts) {
      opts = Object.assign(
        {
          timeout: [ '30s', '30s' ],
          dataType: 'json',
        },
        opts
      );
      const { ctx } = this;
      const breaker = new circuitBreaker(async function() {
        // create http request here
        return await ctx.curl(url, opts);
      }, breakerConfig);
      breaker.fallback(err => {
        ctx.logger.error(`[circuitBreaker]-fallback: ${url} got error`, err);
        return {
          code: '502',
          message: 'service not available',
          data: '',
        };
      });

      this.logger.info(
        'request external service: %s with params',
        url,
        opts && opts.data
      );
      const t1 = Date.now();
      const result = await breaker.fire().then(r => {
        const cost = Date.now() - t1;
        this.logger.debug('[%sms]response from [%s]: %j', cost, url, r);
        return r && r.data;
      });
      return result;
    }
  }

then i use jmeter to test my application,i got CPU profile like this:
image
image

@HOTTIN
Copy link
Author

HOTTIN commented Dec 4, 2018

Performance issues #181
implement a singleton service could resolve this problem

@HOTTIN HOTTIN closed this as completed Dec 4, 2018
lance added a commit that referenced this issue Jan 7, 2019
Eliminates memory leak when many circuits are created over
and over.

Fixes: #248
Fixes: #181
Fixes: #245
lance added a commit that referenced this issue Jan 8, 2019
Shutting down a circuit will cause it to always return a
rejected promise with an `ESHUTDOWN` `Error.code` when
`circuit.fire()` is called, and the Hystrix stats stop
accumulating. Once a circuit has been shut down, it cannot
be reset or used again.

When using the `shutdown()` method on a circuit, all listeners
are cleaned up internally, preventing memory leaks.

Fixes: #248
Fixes: #181
Fixes: #245
lance added a commit that referenced this issue Jan 9, 2019
Shutting down a circuit will cause it to always return a
rejected promise with an `ESHUTDOWN` `Error.code` when
`circuit.fire()` is called, and the Hystrix stats stop
accumulating. Once a circuit has been shut down, it cannot
be reset or used again.

When using the `shutdown()` method on a circuit, all listeners
are cleaned up internally, preventing memory leaks.

Fixes: #248
Fixes: #181
Fixes: #245
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

1 participant