Skip to content

S001 ABEND in datasetGetHandler when reading dataset with I/O error #64

Description

@mgrossmann

Summary

mvsMF crashes with S001 ABEND when a GET request reads a dataset that is in a bad state (e.g. cataloged but not properly allocated on the volume). Instead of returning HTTP 500, the server ABENDs because crent370's @@AREAD has no SYNAD exit registered.

How to reproduce

# 1. Create a dataset that will end up in a bad state.
#    For example, allocate a PS dataset on a volume, then
#    delete the VTOC entry but leave the catalog entry
#    (or let a failed SVC99 leave a stale catalog entry).
#
#    A simpler way: create a dataset, then try to delete+recreate
#    it while another job still has it allocated. The delete fails,
#    the create fails, and a subsequent read triggers the ABEND.

# 2. Attempt to read the broken dataset via the REST API:
curl -u IBMUSER:SYS1 \
  -H "X-IBM-Data-Type: binary" \
  "http://<host>:<port>/restfiles/ds/IBMUSER.MBT.XMIT.OUT"

The GET triggers read_and_send_datasetfread__fread__fgetc@@AREAD, which hits an I/O error. Because no SYNAD exit is registered on the DCB, MVS takes the default action: ABEND S001.

ABEND trace

IEC020I 001-1,HTTPD,HTTPD,SYS00008,251,WORK00,IBMUSER.MBT.XMIT.OUT
IEC020I NO ERROR HANDLING, (SYNAD), EXIT SPECIFIED
ABEND S001 detected for module 00000000 epname @@AREAD offset 00B8EEB8

@@AREAD
__fgetc
__fread
fread
read_and_send_dataset
datasetGetHandler
handle_request
main
__start

Root cause

Two layers are missing error handling:

  1. crent370 @@AREAD: No SYNAD exit is registered on the DCB. When an I/O error occurs during BSAM/QSAM read, MVS has no error routine to call and issues ABEND S001. A SYNAD exit should be registered so that I/O errors return an error code to the caller instead of crashing.

  2. mvsMF datasetGetHandler: Should validate that the dataset is readable before streaming it. If fopen/fread returns an error, the handler should return HTTP 500 gracefully instead of continuing into the read loop.

Expected behavior

  • GET /restfiles/ds/BROKEN.DATASET should return HTTP 500 with a JSON error body
  • mvsMF should remain running and able to serve subsequent requests

Environment

  • MVS 3.8j on Hercules (TK4-)
  • mvsMF (latest)
  • Triggered during mbt package when XMIT staging dataset was in a bad state

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions