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

[Bug]: Listening phase does not start when listeners are available only in imported modules #41667

Closed
Nadeeshan96 opened this issue Nov 9, 2023 · 0 comments · Fixed by #41762
Assignees
Labels
Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug

Comments

@Nadeeshan96
Copy link
Contributor

Description

Listening phase does not start when listeners are available only in imported modules.

With 7aff2ff it will work when the code is compiled for the first time (without using BIR cache). But the problem will exist when the code is compiled using the BIR cache because both the packageSymbol.bir and importPkgSymbol will be null.

Steps to Reproduce

Without using any Ballerina libraries, the issue can be reproduced as follows.

  1. Clean .Ballerina folder.
  2. Extract the Ballerina package.
    test_listener_non_default.zip
  3. Run bal clean, bal pack, and bal push --repository local for the above package.
  4. Extract the Ballerina package.
    use_listener.zip
  5. Run bal run for the above package. It should hang in the listening phase until SIGINT is received.

Issue with http listeners is illustrated below.

  1. Run bal clean, bal pack, and bal push --repository local for a Ballerina package with below service.
import ballerina/http;

listener http:Listener httpListener = new (8080);

service / on httpListener {
    resource function get greeting() returns string { 
        return "Hello, World!"; 
    }
}

Ballerina.toml

[package]
org = "nadeeshand"
name = "httpservice"
version = "0.1.0"

[build-options]
observabilityIncluded = true
  1. Create another bal package with below code and run it. It does not go to the listening phase when the code is compiled from BIR cache. If the listener is in a non-default module I think it will not work in the first time compilation also.
import nadeeshand/httpservice as _;

Ballerina.toml

[package]
org = "nadeeshand"
name = "usehttpservice"
version = "0.1.0"


[[dependency]]
org = "nadeeshand"
name = "httpservice"
version = "0.1.0"
repository = "local"

[build-options]
observabilityIncluded = true

Affected Version(s)

2201.7.3

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant