engineer-man / piston

A high performance general purpose code execution engine.
https://emkc.org/run
MIT License
1.89k stars 238 forks source link

Getting stdout length exceeded error while running any code #629

Open girishgl opened 11 months ago

girishgl commented 11 months ago

2023-10-12T09:46:41.724Z [INFO] job/c09627d6-4d89-4e7a-b1e2-979c75ec4ab6: 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' }

Brikaa commented 11 months ago

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

girishgl commented 11 months ago

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"

Brikaa commented 11 months ago

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?

girishgl commented 11 months ago

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