Krosxx / retrofit-rest-client

📡 A http client for Android Studio.
https://plugins.jetbrains.com/plugin/13075-retrofit-rest-client-2-0/
Apache License 2.0
51 stars 7 forks source link

IntelliJ crashes when there is ~16MB of JSON to be beautifiled #6

Closed flauberjp closed 4 years ago

flauberjp commented 4 years ago

This plug-in is very good, but it crashed my IntelliJ when the response was a JSON of only ~16MB.

It retrieved the JSON, but in the process of get it formatted, it consumed all the memory available.

The JSON is basically an array of elements like that { "id": 314415, "ano": 2020, "mes": 2, "valor": 1716.59, "referencia": 1000000, "prazo": 0, "gaeExtraMeta": 0, "ativo": true, "servidor": { "id": 1, "nome": "Servidor 1", "cpf": "15404951400", "rg": "1479141", "matriculaTce": "599646", "matriculaExterna": "1", "naturalidade": "João Pessoa", "nacionalidade": "Brasileira", "nomeMae": "Mãe de Servidor 1", "nomePai": "Pai de Servidor 1", "email": "Serv@teste.com.br", "dataNascimento": "2010-03-12", "dataFalecimento": null, "nomeConjuge": "Cônjuge de Servidor 1", "login": "jcarvalho", "nitPisPasep": "15875", "tituloEleitor": "19342797783", "secaoEleitor": "693", "zonaEleitor": "34", "sexo": { "id": 1, "descricao": "Masculino", "ativo": true }, "estadoCivil": { "id": 2, "descricao": "Casado(a)", "codigo": "2", "ativo": true }, "situacaoServidor": { "id": 1, "descricao": "Ativo", "ativo": true }, "deficiencias": [], "enderecos": [ { "id": 1, "logradouro": "Rua Servidor Teste 1", "numero": "1", "bairro": "Jaguaribe", "cep": "58052130", "complemento": null, "ativo": true, "municipio": { "id": 1457, "nome": "Paulista", "uf": { "id": 25, "nome": "Paraíba", "sigla": "PB" } } }, { "id": 2, "logradouro": "Rua Servidor Teste 2", "numero": "2", "bairro": "Jaguaribe", "cep": "58052130", "complemento": null, "ativo": true, "municipio": { "id": 1457, "nome": "Paulista", "uf": { "id": 25, "nome": "Paraíba", "sigla": "PB" } } }, { "id": 5, "logradouro": "Rua Servidor Teste 5", "numero": "5", "bairro": "Jaguaribe", "cep": "58052130", "complemento": null, "ativo": true, "municipio": { "id": 1457, "nome": "Paulista", "uf": { "id": 25, "nome": "Paraíba", "sigla": "PB" } } }, { "id": 3, "logradouro": "Rua Servidor Teste 3", "numero": "3", "bairro": "Jaguaribe", "cep": "58052130", "complemento": null, "ativo": true, "municipio": { "id": 1457, "nome": "Paulista", "uf": { "id": 25, "nome": "Paraíba", "sigla": "PB" } } }, { "id": 4, "logradouro": "Rua Servidor Teste 4", "numero": "4", "bairro": "Jaguaribe", "cep": "58052130", "complemento": null, "ativo": true, "municipio": { "id": 1457, "nome": "Paulista", "uf": { "id": 25, "nome": "Paraíba", "sigla": "PB" } } } ], "telefones": [ { "id": 1, "ddd": "83", "numero": "999999999", "ativo": true }, { "id": 1001, "ddd": "83", "numero": "999999999", "ativo": true } ], "senhaContracheque": "100006", "anotacao": null }, "remuneracaoCodigo": { "id": 20, "codigo": 20, "descricao": "VENCIMENTO", "credor": false, "indenizavel": true, "ativo": true } } ]

Environment info: IntelliJ IDEA 2019.3.1 (Community Edition) Build #IC-193.5662.53, built on December 18, 2019 Runtime version: 11.0.5+10-b520.17 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0 GC: ParNew, ConcurrentMarkSweep Memory: 2002M Cores: 4 Registry: Non-Bundled Plugins: Lombook Plugin, org.sonarlint.idea

Krosxx commented 4 years ago

ok, i will fix it later

Krosxx commented 4 years ago

https://github.com/Vove7/retrofit-rest-client/commit/3a2198dd6df156dfa11f64bd84a9c6f3127ac343

flauberjp commented 4 years ago

Nice! I tried to test it now, but the version available there at Plugins dialog still 2.1.6. How long time does it need to get updated? Any idea @Vove7 ?

Krosxx commented 4 years ago

@flauberjp just download https://github.com/Vove7/retrofit-rest-client/blob/master/retrofit-rest-client.zip

flauberjp commented 4 years ago

The issue still there, please re-open it.

It did the query, retrieved all the content, as evidenced by the image below. image

But after that step, it tries to format the JSON, then my IDE does not support that processing, starting saying the the system is getting low on memory, in the end this shows up: image

On that image there is a "Analyze Memory Use" button, I clicked it, but I think it will not work... if it would, then I will share it here later.

Could you point to me where is the code that do that processing? Maybe I could help...

Krosxx commented 4 years ago

Could you provide me your test url? thanks.

flauberjp commented 4 years ago

yes, sure, but the system is an internal one. Attached it is the file request.rest I used to trigger the query. I renamed it to request.txt, so I could attached it here. request.txt

Below the start of the file with a little of the response:

GET http://localhost:9001/remuneracao-servidor/2020 @Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNlcmJlcnVzX2tpZF92MSJ9.eyJ0aXBvX3VzdWFyaW9faWQiOjEsInVzZXJfbmFtZSI6InZkYW50YXM6MToyOnNpc3JoIiwic2lzdGVtYSI6IlNpc3RlbWEgZGUgUkgiLCJzaXN0ZW1hX2lkIjoyLCJpbmZvX3VzdWFyaW8iOiJsb2dpbjp2ZGFudGFzKDM5OSkgLSB0aXBvOlNlcnZpZG9yIGRvIFRDRS1QQigxKSAtIHNpc3RlbWE6c2lzcmgoMikgLSBjbGllbnRlOnNpc3JoIiwibm9tZSI6IlVzdcOhcmlvIDM5OSIsImxvZ2luIjoidmRhbnRhcyIsImF1dGhvcml0aWVzIjpbInNpc3JoOnVzdWFyaW9zLmF0dWFsaXphciIsInNpc3JoOnVzdWFyaW9zLmNyaWFyIiwiY2VyYmVydXM6YWRtaW4iLCJzaXNyaDp1c3Vhcmlvcy5nZXN0b3IiLCJlbWFpbDp2aXN1YWxpemFyIiwiZW1haWw6YWRtaW4iLCJjZXJiZXJ1czphZG1pbl9zaXN0ZW1hIiwic2lzcmg6dXN1YXJpb3MudmlzdWFsaXphciIsImNlcmJlcnVzOmdlcmVuY2lhcnBlcmZpcyIsInNpc3JoOmFkbWluIl0sImNsaWVudF9pZCI6InNpc3JoIiwic2NvcGUiOlsicmVhZCIsIndyaXRlIiwiaW5mbyJdLCJjcGYiOiIwMTE3ODg3NzQ5MyIsImlkIjozOTksImV4cCI6MTU4NTg2NzQxMCwidGlwb191c3VhcmlvIjoiU2Vydmlkb3IgZG8gVENFLVBCIiwianRpIjoiNTQwZDFiMjAtNzg5YS00ZDcyLTk0OWUtNzk5MDFkYjQ1ZGMwIn0.FetDYDQewrUn9AcxRJ14H7roSwcR9DrSfKHOPFujopUE3uDoDHzT9onm-6JzGX0kmv3IpWf8emRoE15F0Zm660IWXscj6-ThrGMhXIfqGTjwpsu4RCuB2q2S1FO4BuNJWCT-M9H5DcCnh7jHzZSqYCbd0KmGscxpcSslZpHP-NW_qTVw0xWMoE4phKU0JfQeIA52_nYifjaLQPcHxVsrUP_ZVZSVWp70zR80XY7mkfoM1C95DIVRvquDjC-UFPqHlWzZTPV3xwUlY3896Qqc5TNTbnfsWoY8ml8RXEVLCzT8fITCdK88K0ZVrcdEp1umYUQG18eHYRF2_onw1FLVElr9dB2JV_IlrpRLe69kotVKaf8eN_OQhik3jJvRCD9LkbigsiGCpiD3jnYvF6-MmHuUBjr16YzrrQSHV8ch2G0tqu_TH9OwqpyOlQHBmgwi-79VcNofGsSov9vXziCrg3C0fQYAGgrkxOyvFK3qvL0fwA8T3ruQR_Hu0igYG78DTfr7OuBcSnFEVItldoi21FsQPgG6uYDYBOap0Jr8ES9gzNrZrz3jLblwPXdg93WLXRj9eozwndqX2yb-ZL3_w4HDI3d5mepQBDWOpJzfcKanAY9kZdBDYTELahV_FaaFyt3y8LQBc7VfHESjVHhDJssUooaPI2zSp_vj2m-X0

%%%

Duration: 2512 ms

GET

http://localhost:9001/remuneracao-servidor/2020

Headers

@Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNlcmJlcnVzX2tpZF92MSJ9.eyJ0aXBvX3VzdWFyaW9faWQiOjEsInVzZXJfbmFtZSI6InZkYW50YXM6MToyOnNpc3JoIiwic2lzdGVtYSI6IlNpc3RlbWEgZGUgUkgiLCJzaXN0ZW1hX2lkIjoyLCJpbmZvX3VzdWFyaW8iOiJsb2dpbjp2ZGFudGFzKDM5OSkgLSB0aXBvOlNlcnZpZG9yIGRvIFRDRS1QQigxKSA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9OwqpyOlQHBmgwi-79VcNofGsSov9vXziCrg3C0fQYAGgrkxOyvFK3qvL0fwA8T3ruQR_Hu0igYG78DTfr7OuBcSnFEVItldoi21FsQPgG6uYDYBOap0Jr8ES9gzNrZrz3jLblwPXdg93WLXRj9eozwndqX2yb-ZL3_w4HDI3d5mepQBDWOpJzfcKanAY9kZdBDYTELahV_FaaFyt3y8LQBc7VfHESjVHhDJssUooaPI2zSp_vj2m-X0

status 200

@Access-Control-Allow-Origin: * @Access-Control-Allow-Methods: POST,PUT,GET,DELETE,OPTIONS @Access-Control-Max-Age: 3600 @Access-Control-Allow-Headers: Content-Type, Authorization @Access-Control-Allow-Credentials: true @X-Content-Type-Options: nosniff @X-XSS-Protection: 1; mode=block @Cache-Control: no-cache, no-store, max-age=0, must-revalidate @Pragma: no-cache @Expires: 0 @X-Frame-Options: DENY @Content-Type: application/json @Transfer-Encoding: chunked @Date: Mon, 30 Mar 2020 11:48:00 GMT @Keep-Alive: timeout=60 @Connection: keep-alive

[{"id":314415,"ano":2020,"mes":2,"valor":1716.59,"referencia":1000000,"prazo":0,"gaeExtraMeta":0,"ativo":true,"servidor":{"id":1,

Krosxx commented 4 years ago

Try it again.😁 https://github.com/Vove7/retrofit-rest-client/blob/master/retrofit-rest-client.zip

Krosxx commented 4 years ago

Oh ,sorry, there has a bug just now, it has been resolved. need re-download plugin file.

flauberjp commented 4 years ago

OK. I am not able by now, but soon I send the result.

On Mon, Mar 30, 2020 at 9:57 AM Vove7 notifications@github.com wrote:

Oh ,sorry, there has a bug just now, it has been resolved. need re-download plugin file.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Vove7/retrofit-rest-client/issues/6#issuecomment-605982827, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADIIIKYL4SJNHAQLD4IUTZLRKCJM3ANCNFSM4LS5O7EQ .

flauberjp commented 4 years ago

@Vove7 I tested it, my IntelliJ is not crasing anymore, so I am going to close this issue, thanks a lot!