piston icon indicating copy to clipboard operation
piston copied to clipboard

Getting stdout length exceeded error while running any code

Open girishgl opened this issue 2 years ago • 4 comments

[37m2023-10-12T09:46:41.724Z [32;22m[INFO] [39;1mjob/c09627d6-4d89-4e7a-b1e2-979c75ec4ab6[0m: stdout length exceeded node:internal/errors:415 ErrorCaptureStackTrace(err); ^ Error: kill ESRCH at process.kill (node:internal/process/per_thread:212:13) at Socket. (/piston_api/src/job.js:229:29) at Socket.emit (node:events:378:20) at Socket.EventEmitter.emit (node:domain:470:12) at addChunk (node:internal/streams/readable:313:12) at readableAddChunk (node:internal/streams/readable:288:9) at Socket.Readable.push (node:internal/streams/readable:227:10) at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) { errno: -3, code: 'ESRCH', syscall: 'kill' }

girishgl avatar Oct 12 '23 11:10 girishgl

What code were you trying to execute? And where are these logs from?

Brikaa avatar Oct 12 '23 12:10 Brikaa

This is java code

"using System;\n\nclass Program\n{\n public static void Main()\n {\n int num1 = Convert.ToInt32(Console.ReadLine());\n\n int num2 = Convert.ToInt32(Console.ReadLine());\n\n int sum = AddNumbers(num1, num2);\n Console.WriteLine(sum);\n\n }\n\n static int AddNumbers(int num1, int num2)\n {\n return num1 + num2;\n }\n}\n"

girishgl avatar Oct 12 '23 12:10 girishgl

This seems to be CSharp code. It works properly on the public api: https://emkc.org/s/qbMIfs. And running it in Java gives the appropriate error (not stdout length exceeded). Are you using the public API or did you build Piston?

Brikaa avatar Oct 12 '23 12:10 Brikaa

We are you not using the public API. We have deployed Piston on cloud.

Sorry that was C# code.

this one is java code


import java.util.*;
public class Main {
    static int print2largest(int arr[],int arr_size) {
        int i, first, second;
        if (arr_size < 2) {
            // System.out.print("Invalid Input");
            return -1;
        }
        Arrays.sort(arr);
        for (i = arr_size - 2; i >= 0; i--) {
	        if (arr[i] != arr[arr_size - 1]) {
	           // System.out.print(arr[i]);
	            return arr[i];
	        }
        }   
        return -1;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[n];
        for(int i = 0; i<n; i++) {
            arr[i] = sc.nextInt();
        }
        System.out.print(print2largest(arr, n));
    }
}

Here is our configuration

ENV PISTON_LIMIT_OVERRIDES='{"csharp.net":{"run_timeout":10000, "compile_timeout":30000},"java":{"run_timeout":10000},"python":{"run_timeout":10000},"javascript":{"run_timeout":10000}}'
ENV PISTON_LOG_LEVEL=INFO
ENV PISTON_OUTPUT_MAX_SIZE=1024000

girishgl avatar Oct 12 '23 13:10 girishgl